[PyQt] problem with pyqt 4.6

Linos info at linos.es
Fri Oct 16 16:37:25 BST 2009


Phil Thompson escribió:
> On Fri, 16 Oct 2009 16:27:00 +0200, Linos <info at linos.es> wrote:
>> i dont know if this is a bug or a change in behaviour but keyPressEvent
>> dont 
>> catch the keyboard events in my QWidget or QDialog subclasses. In the
>> example 
>> added with PyQt 4.4 you can press any key and get his int code printed
> but
>> with 
>> last snapshot it never prints anything.
>>
>> ----- CODE
>>
>> # -*- coding: utf-8 -*-
>> import sys
>> from PyQt4.QtCore import *
>> from PyQt4.QtGui import *
>>
>> class TestWidget(QWidget):
>>      def __init__(self, parent):
>>          super(TestWidget, self).__init__()
>>
>>          self.button = QPushButton("test")
>>
>>          layout = QVBoxLayout()
>>          layout.addWidget(self.button)
>>          self.setLayout(layout)
>>
>>      def keyPressEvent(self, event):
>>          print event.key()
>>
>>
>> def main():
>>      app = QApplication(sys.argv)
>>
>>      widget = TestWidget(None)
>>      widget.show()
>>      return app.exec_()
>>
>> if __name__ == "__main__":
>>      main()
> 
> Works fine for me.
>
> Phil

Yes you have reason i have downloaded, compiled and installed the snapshots 
sip-4.9.1-snapshot-20091015.tar.gz and 
PyQt-x11-gpl-4.6.1-snapshot-20091014.tar.gz and now it works, i had installed 
the old snapshots sip-4.9.1-snapshot-20091010 and 
PyQt-x11-gpl-4.6.1-snapshot-20091009 before, thanks.

Miguel Angel.


More information about the PyQt mailing list