[PyQt] Cannot get any SIGNAL from QTreeWidget

Russell Valentine russ at coldstonelabs.org
Wed Apr 14 16:21:04 BST 2010


You try the new signals and slots?
self.projectTree.itemClicked.connect(self.debug1)

On 04/14/10 09:54, Bjorn Egil Ludvigsen wrote:
> Thank you very much Vincent, your second option using another signal
> "itemSelectionChanged()" worked very well, so I can use that to perform
> other actions.
> 
> However, I still cannot get the "itemClicked(QTreeWidgetItem*)" to work (or
> "itemDoubleClicked..."), even with sending the column (int) in addition,
> which should not be necessary in PyQt.
> 
> Appreciate more help on this, but not critical for now with Vincent's
> suggestion.
> 
> Regards,
> Bjorn
> 
> On Tue, Apr 13, 2010 at 10:35 PM, Vincent Vande Vyvre <
> vincent.vandevyvre at swing.be> wrote:
> 
>> Try with "itemClicked(QTreeWidgetItem*, int)
>>
>> also:
>>
>>         self.connect(self.projectTree,
>>                 SIGNAL("itemSelectionChanged()"),
>>                 self.showEvents)
>>
>>         def showEvents(self):
>>             item = self.projectTree.currentItem()
>>
>> Bjorn Egil Ludvigsen a écrit :
>>
>>   Hi,
>>
>> I cannot get any signal from QTreeWidget and wonder if anyone have any idea
>> of where to look?
>>
>> I have a QMainWindow with a QTabWidget and some QDockWidgets. A QTreeWidget
>> is added to the dockwidget. After successfully populating all tables and the
>> tree with data, I want to click on certain items in the tree to select data
>> and set focus on a particular table. When I click in the tree it looks like
>> items are selected (background color is set), but I am not able to get any
>> actions out of it.
>>
>> To debug I am checking to see if items are clicked:
>>
>>         self.connect(self.uncertaintyTable,
>>                 SIGNAL("itemDoubleClicked(QTableWidgetItem*)"),
>> self.debug1)
>>         self.connect(self.projectTree,
>>                 SIGNAL("itemClicked(QTreeWidgetItem*)"),
>>                 self.showEvents)
>> .
>> .
>> .
>> .
>>     def debug1(self):
>>         self.logMessages.addItem("Uncertainty table item double
>> clicked")
>>     def showEvents(self):
>>         self.logMessages.addItem("tree item clicked")
>>
>> For the table I successfully see the text that the item was clicked (or
>> double clicked), but for the tree I cannot get anything to work.
>>
>> Regards,
>> Bjorn
>>


More information about the PyQt mailing list