Saturday, 15 February 2014

python - How to click QTreeWidgetItem programmatically -



python - How to click QTreeWidgetItem programmatically -

there function triggered when qtreewidgetitem clicked user. wonder if there way "click" item programmatically. i've tried

.setcurrentindex(index) .setcurrentitem(item)

but while these methods set item "active" not trigger onclick function.

connect signal treewidget.currentitemchanged onclick get current item , save in variable change current item using setcurrentitem(item) method

treewidget.currentitemchanged.connect(onclick) previousitem = treewidget.currentitem() treewidget.setcurrentitem(item) def onclick(current, previous): print current.text(0) if current not none else none # set whatever index item has print previous.text(0) if previous not none else none

python pyqt

No comments:

Post a Comment