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 



_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to