コード例 #1
0
ファイル: decorators.py プロジェクト: tpDcc/tpDcc-libs-qt
 def wrapper(*args, **kwargs):
     cursor = QCursor(Qt.ArrowCursor)
     QApplication.setOverrideCursor(cursor)
     try:
         return fn(*args, **kwargs)
     finally:
         QApplication.restoreOverrideCursor()
コード例 #2
0
ファイル: tabbars.py プロジェクト: tpDcc/tpDcc-libs-qt
    def mousePressEvent(self, event):
        """
        Override the behaviour when the mouse is pressed
        """

        self._drag_initiated = False
        self._drag_dropped_pos = QPoint()

        if event.button() == Qt.LeftButton and event.modifiers(
        ) == Qt.ControlModifier:
            self._drag_start_pos = event.pos()

            # Get mouse position and store the area rectangle of the selected tab
            pos = event.pos()
            self._select_tab_index = self.tabAt(pos)
            rect = self.tabRect(self._select_tab_index)

            # Store a pixmap of the selected tab and a pixmap of the close hand cursor image
            # After that we draw the tab and also the hand cursor in the middle of the tab
            pixmap = QPixmap.grabWidget(self, rect)
            painter = QPainter(pixmap)
            cursor_pm = QPixmap(':/icons/close_hand_cursor.png')
            cursor_pos = QPoint(*map(lambda x, y: (x - y) * 0.5,
                                     rect.size().toTuple(),
                                     cursor_pm.size().toTuple()))
            painter.drawPixmap(cursor_pos, cursor_pm)
            painter.end()

            # Update cursor
            cursor = QCursor(pixmap)
            self.setCursor(cursor)

        super(TearOffTabBar, self).mousePressEvent(event)
コード例 #3
0
ファイル: btnWin.py プロジェクト: OneLight-Develop-Team/Zeus
    def enterEvent(self, event):

        pos = QCursor().pos()

        self.btnInfoWidget = BtnInfoWidget(self.path, self.type, self.name)
        self.btnInfoWidget.move(pos.x() + 50, pos.y() + 50)
        self.btnInfoWidget.move(self.width() + self.geometry().x() + self.parent().parent().geometry().x(), \
            self.height() + self.geometry().y() +self.parent().parent().geometry().y())

        self.btnInfoWidget.show()

        super(btnWin, self).enterEvent(event)
コード例 #4
0
 def mouseReleaseEvent(self, QMouseEvent):
     self.m_flag = False
     self.setCursor(QCursor(Qt.ArrowCursor))
コード例 #5
0
 def mousePressEvent(self, event):
     if event.button() == Qt.LeftButton:
         self.m_flag = True
         self.m_Position = event.globalPos() - self.pos()  #获取鼠标相对窗口的位置
         event.accept()
         self.setCursor(QCursor(Qt.OpenHandCursor))  #更改鼠标图标