コード例 #1
0
 def keyPressEvent(self, event):
     factor = PointSize / 4
     changed = False
     if event.modifiers() & Qt.ShiftModifier:
         if event.key() == Qt.Key_Left:
             self.boundingRect().setRight(self.boundingRect().right() -
                                          factor)
             changed = True
         elif event.key() == Qt.Key_Right:
             self.boundingRect().setRight(self.boundingRect().right() +
                                          factor)
             changed = True
         elif event.key() == Qt.Key_Up:
             self.boundingRect().setBottom(self.boundingRect().bottom() -
                                           factor)
             changed = True
         elif event.key() == Qt.Key_Down:
             self.boundingRect().setBottom(self.boundingRect().bottom() +
                                           factor)
             changed = True
     if changed:
         self.update()
         global Dirty
         Dirty = True
     else:
         QGraphicsItem.keyPressEvent(self, event)
コード例 #2
0
 def keyPressEvent(self, event):
     # ?????????????????????????/为什么没效果?????????????????????????????
     factor = PointSize / 4  # 移动精度
     changed = False
     if event.modifiers() & Qt.ShiftModifier:
         if event.key() == Qt.Key_Left:
             self.rect.setRight(self.rect.right() - factor)
             # void QRect::setRight(int x) Sets the right edge of the rectangle to the given x coordinate
             # May change the width, but will never change the left edge of the rectangle.
             # moveRight() Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate. The rectangle's size is unchanged.
             changed = True
         elif event.key() == Qt.Key_Right:
             self.rect.setRight(self.rect.right() + factor)
             changed = True
         elif event.key() == Qt.Key_Up:
             self.rect.setBottom(self.rect.bottom() - factor)
             changed = True
         elif event.key() == Qt.Key_Down:
             self.rect.setBottom(self.rect.bottom() + factor)
             changed = True
     if changed:
         self.update()
         global Dirty
         Dirty = True
     else:
         QGraphicsItem.keyPressEvent(self, event)
コード例 #3
0
    def keyPressEvent(self, event: QKeyEvent):
        """event.key() seems to be capital only?

        Args:
            event: the key event
        """
        # print("press", ord('g'))
        if event.text() == 'g':
            print("hey het")
        return QGraphicsItem.keyPressEvent(self, event)
コード例 #4
0
    def keyPressEvent(self, event):
        """event.key() seems to be capital only?

        Args:
            event (TYPE): Description
        """
        print("press", ord('g'))
        if event.text() == 'g':
            print("hey het")
        return QGraphicsItem.keyPressEvent(self, event)
コード例 #5
0
ファイル: selectslicetool.py プロジェクト: cadnano/cadnano2.5
    def keyPressEvent(self, event: QKeyEvent):
        """event.key() seems to be capital only?

        Args:
            event (TYPE): Description
        """
        # print("press", ord('g'))
        if event.text() == 'g':
            print("hey het")
        return QGraphicsItem.keyPressEvent(self, event)
コード例 #6
0
ファイル: BoxItem.py プロジェクト: roehead/PyQtGraphView
 def keyPressEvent(self, event):
     factor = self.parentWidget().PointSize / 4
     changed = False
     if event.modifiers() & Qt.ShiftModifier:
         if event.key() == Qt.Key_Left:
             self.rect.setRight(self.rect.right() - factor)
             changed = True
         elif event.key() == Qt.Key_Right:
             self.rect.setRight(self.rect.right() + factor)
             changed = True
         elif event.key() == Qt.Key_Up:
             self.rect.setBottom(self.rect.bottom() - factor)
             changed = True
         elif event.key() == Qt.Key_Down:
             self.rect.setBottom(self.rect.bottom() + factor)
             changed = True
     if changed:
         self.update()
         #QMessageBox.warning(None, "debug","BoxItem be changed!")
         global Dirty
         Dirty = True
     else:
         #QMessageBox.warning(None, "debug","BoxItem do not be changed!")
         QGraphicsItem.keyPressEvent(self, event)
コード例 #7
0
 def keyPressEvent(self, event):
     if self.m_plugin_id >= 0 and event.key() == Qt.Key_Delete:
         event.accept()
         canvas.callback(ACTION_PLUGIN_REMOVE, self.m_plugin_id, 0, "")
         return
     QGraphicsItem.keyPressEvent(self, event)