[PyQt] keyPressEvent

\Q\ mie.iscrizioni at gmail.com
Sat Jun 6 15:41:07 BST 2009


hello,

i'm a pyqt noob...
I have 2 QTableView (tView1 an tView2) on a QMainWindow

,What i need is to know how to find the 'sender' of a keyPressEvent that i
have 
received on a QMainWindow , in my specific situation, if the event is by
tView1 or tView2:

<code>
[...]
class MainWindow(QMainWindow, ui_clienti.Ui_MainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.setupUi(self)
        self.setupMenu()
        self.restoreWinSettings()

        self.filename = None
        self.filtered = False
        self.db = QSqlDatabase.addDatabase("QSQLITE")

        self.loadInitialFile()
        self.setupUiSignals()

    def keyPressEvent(self, event):
        if event.key() == Qt.Key_Down:
            self.addCliRecord()
        elif event.key() == Qt.Key_Escape:
            self.cModel.revertAll()
            self.cModel.select()
        else:
            QMainWindow.keyPressEvent(self, event)
[...]
</code>

Thanks a lot.
-- 
View this message in context: http://www.nabble.com/keyPressEvent-tp23902252p23902252.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list