I am trying to set up two-key shortcuts without modifiers in Pyside/PyQt4.
I have tried various combinations of QEvents and QKeySequences, but to no avail.
What I would like to do is something like this:
def keyPressEvent(self, event): if (event.key() == QtCore.Qt.Key_O) and (event.key() == QtCore.Qt.Key_P ): print('shortcut op accepted')
or
fileMenu.addAction(QtGui.QAction("Open Project", self, shortcut=QtGui.QKeySequence("P" and "O"),triggered=self.openProject))
where the users presses, O, then P and then the action occurs.
Does anyone know firstly if this is possible and if so how to do it?
and
operator for strings cannot be the right thing here because"P" and "O"
is just"O"
. – Trilarion