當前位置: 首頁>>代碼示例>>Python>>正文


Python Qt.QCursor類代碼示例

本文整理匯總了Python中PyQt5.Qt.QCursor的典型用法代碼示例。如果您正苦於以下問題:Python QCursor類的具體用法?Python QCursor怎麽用?Python QCursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了QCursor類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: show_context_menu

    def show_context_menu(self, point):
        item = self.currentItem()

        def key(k):
            sc = unicode_type(QKeySequence(k | Qt.CTRL).toString(QKeySequence.NativeText))
            return ' [%s]'%sc

        if item is not None:
            m = QMenu()
            m.addAction(QIcon(I('edit_input.png')), _('Change the location this entry points to'), self.edit_item)
            m.addAction(QIcon(I('modified.png')), _('Bulk rename all selected items'), self.bulk_rename)
            m.addAction(QIcon(I('trash.png')), _('Remove all selected items'), self.del_items)
            m.addSeparator()
            ci = unicode_type(item.data(0, Qt.DisplayRole) or '')
            p = item.parent() or self.invisibleRootItem()
            idx = p.indexOfChild(item)
            if idx > 0:
                m.addAction(QIcon(I('arrow-up.png')), (_('Move "%s" up')%ci)+key(Qt.Key_Up), self.move_up)
            if idx + 1 < p.childCount():
                m.addAction(QIcon(I('arrow-down.png')), (_('Move "%s" down')%ci)+key(Qt.Key_Down), self.move_down)
            if item.parent() is not None:
                m.addAction(QIcon(I('back.png')), (_('Unindent "%s"')%ci)+key(Qt.Key_Left), self.move_left)
            if idx > 0:
                m.addAction(QIcon(I('forward.png')), (_('Indent "%s"')%ci)+key(Qt.Key_Right), self.move_right)

            m.addSeparator()
            case_menu = QMenu(_('Change case'))
            case_menu.addAction(_('Upper case'), self.upper_case)
            case_menu.addAction(_('Lower case'), self.lower_case)
            case_menu.addAction(_('Swap case'), self.swap_case)
            case_menu.addAction(_('Title case'), self.title_case)
            case_menu.addAction(_('Capitalize'), self.capitalize)
            m.addMenu(case_menu)

            m.exec_(QCursor.pos())
開發者ID:j-howell,項目名稱:calibre,代碼行數:35,代碼來源:main.py

示例2: show_context_menu

 def show_context_menu(self, point):
     idx = self.currentIndex()
     if idx and idx.isValid() and not idx.data(Qt.UserRole):
         m = QMenu()
         m.addAction(QIcon(I('view.png')), _('View this cover at full size'), self.show_cover)
         m.addAction(QIcon(I('edit-copy.png')), _('Copy this cover to clipboard'), self.copy_cover)
         m.exec_(QCursor.pos())
開發者ID:j-howell,項目名稱:calibre,代碼行數:7,代碼來源:single_download.py

示例3: workaround_broken_under_mouse

 def workaround_broken_under_mouse(ch):
     import sip
     from PyQt5.Qt import QCursor, QToolButton
     # See https://bugreports.qt-project.org/browse/QTBUG-40233
     if isinstance(ch, QToolButton) and not sip.isdeleted(ch):
         ch.setAttribute(Qt.WA_UnderMouse, ch.rect().contains(ch.mapFromGlobal(QCursor.pos())))
         ch.update()
開發者ID:d-faure,項目名稱:calibre,代碼行數:7,代碼來源:__init__.py

示例4: exec

	def exec(self, x = None, y = None):
		if x is None:
			super(Menu, self).exec(QCursor.pos())
		else:
			super(Menu, self).exec(QPoint(x, y))
開發者ID:Fe-ver,項目名稱:hae,代碼行數:5,代碼來源:menu.py

示例5: sample_direction

 def sample_direction(self,time_):
         if len(self.mouse_positions)>1:
                 self.mouse_positions[time_]=QCursor.pos()
開發者ID:mopperwhite,項目名稱:pyqtsaomenu,代碼行數:3,代碼來源:sao_menu.py

示例6: sample_pos

 def sample_pos(self,time_):
         self.mouse_positions[time_]=QCursor.pos()
開發者ID:mopperwhite,項目名稱:pyqtsaomenu,代碼行數:2,代碼來源:sao_menu.py

示例7: collapse_menu_hovered

 def collapse_menu_hovered(self, action):
     tip = action.toolTip()
     if tip == '*':
         tip = ''
     QToolTip.showText(QCursor.pos(), tip)
開發者ID:Aliminator666,項目名稱:calibre,代碼行數:5,代碼來源:view.py

示例8: contextMenuEvent

    def contextMenuEvent(self, event):
        """右鍵點擊事件"""

        self._menu.popup(QCursor.pos())
開發者ID:hack1943,項目名稱:DevilYuan,代碼行數:4,代碼來源:DySubInfoWidget.py


注:本文中的PyQt5.Qt.QCursor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。