当前位置: 首页>>代码示例>>Python>>正文


Python QCursor.pos方法代码示例

本文整理汇总了Python中PyQt5.Qt.QCursor.pos方法的典型用法代码示例。如果您正苦于以下问题:Python QCursor.pos方法的具体用法?Python QCursor.pos怎么用?Python QCursor.pos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.Qt.QCursor的用法示例。


在下文中一共展示了QCursor.pos方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show_context_menu

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
    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,代码行数:37,代码来源:main.py

示例2: show_context_menu

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
 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,代码行数:9,代码来源:single_download.py

示例3: workaround_broken_under_mouse

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
 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,代码行数:9,代码来源:__init__.py

示例4: exec

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
	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,代码行数:7,代码来源:menu.py

示例5: sample_direction

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
 def sample_direction(self,time_):
         if len(self.mouse_positions)>1:
                 self.mouse_positions[time_]=QCursor.pos()
开发者ID:mopperwhite,项目名称:pyqtsaomenu,代码行数:5,代码来源:sao_menu.py

示例6: sample_pos

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
 def sample_pos(self,time_):
         self.mouse_positions[time_]=QCursor.pos()
开发者ID:mopperwhite,项目名称:pyqtsaomenu,代码行数:4,代码来源:sao_menu.py

示例7: collapse_menu_hovered

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
 def collapse_menu_hovered(self, action):
     tip = action.toolTip()
     if tip == '*':
         tip = ''
     QToolTip.showText(QCursor.pos(), tip)
开发者ID:Aliminator666,项目名称:calibre,代码行数:7,代码来源:view.py

示例8: contextMenuEvent

# 需要导入模块: from PyQt5.Qt import QCursor [as 别名]
# 或者: from PyQt5.Qt.QCursor import pos [as 别名]
    def contextMenuEvent(self, event):
        """右键点击事件"""

        self._menu.popup(QCursor.pos())
开发者ID:hack1943,项目名称:DevilYuan,代码行数:6,代码来源:DySubInfoWidget.py


注:本文中的PyQt5.Qt.QCursor.pos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。