On Wed, 2002-10-23 at 20:28, Konrad Hinsen wrote:
> > They may be filtered out by the widget that has focus, it's hard to
> 
> At least they never appear in keyPressEvent(), neither for the main
> widget nor for the widget in focus.
Since you haven't posted any code it's hard to tell what you're doing
wrong. Are you sure that your widget accepts keyboard focus? Unless you
are subclassing a widget that does, you'll have to call
QWidget::SetFocusPolicy() with the appropriate argument
(Qt::StrongFocus, for instance).

Below is a piece of code that works as expected. I don't call
QWidget::SetFocusPolicy() since QLineEdit does that for me.

import qt
import sys

class MyLineEdit(qt.QLineEdit):
    def keyPressEvent(self, event):
        qt.QLineEdit.keyPressEvent(self, event)
        if event.key() == qt.Qt.Key_Tab:
            print "Tab pressed"
    
app = qt.QApplication(sys.argv)
en = MyLineEdit(None)
app.setMainWidget(en)
en.show()
app.exec_loop()

//Fredrik

_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde

Reply via email to