Exemple #1
0
 def keyPressEvent(self, e):
     evt = self._get_event(e, QEvent.MouseButtonPress)
     if evt:
         self.mousePressEvent(evt)
     else:
         QGraphicsView.keyPressEvent(self, e)
     item = self.itemAt(self.mapFromGlobal(QCursor.pos()))
     if item:
         item.keyPressEvent(e)
Exemple #2
0
 def keyPressEvent(self, e):
     evt = self._get_event(e, QEvent.MouseButtonPress)
     if evt:
         self.mousePressEvent(evt)
     else:
         QGraphicsView.keyPressEvent(self, e)
     item = self.itemAt(self.mapFromGlobal(QCursor.pos()))
     if item:
         item.keyPressEvent(e)
Exemple #3
0
 def _get_event(self, e, typ):
     if e.isAutoRepeat():
         return None
     try:
         btn = {
             qt.Key_Q: qt.LeftButton,
             qt.Key_W: qt.RightButton,
             qt.Key_E: qt.MiddleButton,
         }[e.key()]
     except KeyError:
         return None
     pos = self.mapFromGlobal(QCursor.pos())
     return QMouseEvent(typ, pos, btn, btn, e.modifiers())
Exemple #4
0
 def _get_event(self, e, typ):
     if e.isAutoRepeat():
         return None
     try:
         btn = {
             qt.Key_Q: qt.LeftButton,
             qt.Key_W: qt.RightButton,
             qt.Key_E: qt.MiddleButton,
         }[e.key()]
     except KeyError:
         return None
     pos = self.mapFromGlobal(QCursor.pos())
     return QMouseEvent(typ, pos, btn, btn, e.modifiers())