推荐学习书目
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 · Jul 29, 2017 · 2581 views
    This topic created in 3218 days ago, the information mentioned may be changed or developed.
    比较人性的想法是,每个 Item 带一个唯一的 ID ( int 或 str ),可以自己设置,到时候遍历一遍把所有选中的 Item 的 ID 加入到 List 中,按照需要处理。但是 Qt Designer 里属性什么的好像没有类似的属性可以填,Qt Designer 生成的代码里好像只有 Item 对于 Parent 的 Index,这就不好弄了。。 这个功能好像也挺常用的啊。。

    https://img.alicdn.com/imgextra/i3/3024818780/TB2SjWybMZjyKJjy0FhXXcdlFXa_!!3024818780.png
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5778 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 02:50 · PVG 10:50 · LAX 19:50 · JFK 22:50
    ♥ Do have faith in what you're doing.