本文整理汇总了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())
示例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())
示例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()
示例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))
示例5: sample_direction
def sample_direction(self,time_):
if len(self.mouse_positions)>1:
self.mouse_positions[time_]=QCursor.pos()
示例6: sample_pos
def sample_pos(self,time_):
self.mouse_positions[time_]=QCursor.pos()
示例7: collapse_menu_hovered
def collapse_menu_hovered(self, action):
tip = action.toolTip()
if tip == '*':
tip = ''
QToolTip.showText(QCursor.pos(), tip)
示例8: contextMenuEvent
def contextMenuEvent(self, event):
"""右键点击事件"""
self._menu.popup(QCursor.pos())