[PyKDE] keyReleaseEvent

Emanuele Santos emanuelesantos at gmail.com
Fri Jul 14 01:01:28 BST 2006


Hello guys

When I try to get KeyEvent.text() on a keyReleaseEvent inside a  
QTextEdit it is empty.
Any of you has experienced this before? On Windows it works, but  not  
on Mac.
I am using PyQt-mac-gpl-4.0 and Qt 4.1.3

Here it is a small program to test.

import sys
from PyQt4 import QtGui, QtCore

class myDialog(QtGui.QDialog):
     def __init__(self, parent=None):
         QtGui.QDialog.__init__(self, parent)
         self.text = myTextEdit(self)
         self.text.setReadOnly(False)
         layout = QtGui.QHBoxLayout()
         layout.addWidget(self.text)
         self.setLayout(layout)
         self.resize(300,300)

class myTextEdit(QtGui.QTextEdit):
     def __init__(self, parent):
         QtGui.QTextEdit.__init__(self,parent)

     def keyPressEvent(self, e):
         print "keyPressEvent", str(e.text())
         QtGui.QTextEdit.keyPressEvent(self,e)

     def keyReleaseEvent(self, e):
         print "keyReleaseEvent", str(e.text())
         QtGui.QTextEdit.keyReleaseEvent(self,e)

if __name__ == '__main__':
     app = QtGui.QApplication(sys.argv)
     dialog = myDialog()
     sys.exit(dialog.exec_())

Thanks,

-- Emanuele 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060714/c2e77e8e/attachment.html


More information about the PyQt mailing list