[PyQt] QListWidget SIGNAL problem

Linos info at linos.es
Sat Dec 8 14:51:54 GMT 2007


Phil Thompson escribió:
> On Saturday 08 December 2007, Linos wrote:
>> Linos escribió:
>>> Hello, i have a problem with a listwidget i have created inside a
>>> QToolBox page, if doesnt emit signals, i can select the items but it
>>> doesnt emit itemDoubleClicked or itemClicked or itemActivated, i have
>>> tried with mouse and keyboard without luck, i have installed an event
>>> filter and do a print to every event it pass and i get no event in mouse
>>> click, double click, or keyboard enter, but i can navigate through items
>>> with keyboard or mouse, anyone has any idea what can be the problem here?
>>> or any better way that an eventfilter to debug it?
>>>
>>> Best Regards,
>>> Miguel Angel.
>>> _______________________________________________
>>> PyQt mailing list    PyQt at riverbankcomputing.com
>>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>> I have made an small sample app:
>>
>> ---------------------------------------------------------------------------
>> ----------------------
>>
>> #!/usr/bin/env python
>> from PyQt4.QtCore import *
>> from PyQt4.QtGui import *
>>
>> class ListWidgetTest(QDialog):
>>     def __init__(self, parent=None):
>>         super(ListWidgetTest, self).__init__(parent)
>>
>>         listWidget = QListWidget()
>>         layout = QVBoxLayout()
>>         layout.addWidget(listWidget)
>>         self.setLayout(layout)
>>
>>         self.connect(listWidget,
>> SIGNAL("itemDoubleClicked(QListWidgetItem)"), self.printTest)
>> self.connect(listWidget, SIGNAL("itemClicked(QListWidgetItem)"),
>> self.printTest) self.connect(listWidget,
>> SIGNAL("itemActivated(QListWidgetItem)"), self.printTest) item =
>> QListWidgetItem(self.tr("TESTING SIGNALS"))
>>         item.setData(Qt.UserRole, QVariant(1))
>>         listWidget.insertItem(0, item)
>>
>>     def printTest(self, item):
>>         print "ok!!"
>>
>>
>> if __name__ == "__main__":
>>     import sys
>>     app = QApplication(sys.argv)
>>     dialog = ListWidgetTest()
>>     dialog.show()
>>     app.exec_()
>>
>> ---------------------------------------------------------------------------
>> ----------------------
>>
>> anyone knows where can be the problem here? Thanks.
> 
> The argument type of those signals is "QListWidgetItem *" 
> not "QListWidgetItem".
> 
> Phil
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Argh i am going to be in hell because this i am sure :(, many thanks Phil.
Sorry for the fist private mail i am trying to reply to list but i didnt check the To address.

Regards,
Miguel Angel.





More information about the PyQt mailing list