You connect your treeWidget
's itemActivated
SIGNAL to myfunc
,
QtCore.QObject.connect(self.treeWidget, QtCore.SIGNAL(_fromUtf8("itemActivated(QTreeWidgetItem*,int)")), myfunc)
which means, each time you double click on any node of the tree widget, or press ENTER key when any node is focused, it will print out "Hello Install" in your console.
You'd better connect the itemClicked
with your myfunc
method, and implement myfunc
like this:
def myfunc(item, n):
# print "Hello Install" , item, n
t=str(item.text(n)).lower()
if t == '2. uninstall':
print '----------uninstalling'
elif t == '1. install':
print '+++++++installing'