V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
a251922581
V2EX  ›  Python

请教 PyQt 的树控件 TreeWidget,有简单的方法能获取当前选中的 Item 作为一个列表吗?

  •  
  •   a251922581 · 2017-07-29 20:28:16 +08:00 · 2214 次点击
    这是一个创建于 2468 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比较人性的想法是,每个 Item 带一个唯一的 ID ( int 或 str ),可以自己设置,到时候遍历一遍把所有选中的 Item 的 ID 加入到 List 中,按照需要处理。但是 Qt Designer 里属性什么的好像没有类似的属性可以填,Qt Designer 生成的代码里好像只有 Item 对于 Parent 的 Index,这就不好弄了。。 这个功能好像也挺常用的啊。。

    https://img.alicdn.com/imgextra/i3/3024818780/TB2SjWybMZjyKJjy0FhXXcdlFXa_!!3024818780.png
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2255 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 04:07 · PVG 12:07 · LAX 21:07 · JFK 00:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.