本文整理汇总了Python中PyQt5.QtWidgets.QShortcut方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QShortcut方法的具体用法?Python QtWidgets.QShortcut怎么用?Python QtWidgets.QShortcut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QShortcut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def __init__(self, *args, **kwargs):
super(ObjectInspector, self).__init__(*args, **kwargs)
self._selected_widget = None
self._ui = Ui_ObjectInspector()
self._ui.setupUi(self)
# Make everything monospace.
font = QFont('Monospace')
font.setStyleHint(QFont.TypeWriter)
self._ui.teInspectionResults.setFont(font)
# Register signals.
self._update_key = QShortcut(QKeySequence(Qt.Key_F7), self)
self._ui.btnSelectParent.released.connect(self.select_parent)
self._update_key.activated.connect(self.update_inspection)
示例2: _define_shortcuts
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def _define_shortcuts(self):
self.shortcut_close = QShortcut(QKeySequence(QKeySequence.Close), self)
self.shortcut_close.activated.connect(self._shortcut_proxy(self.close_current_tab))
self.shortcut_new_tab = QShortcut(QKeySequence(QKeySequence.AddTab), self)
self.shortcut_new_tab.activated.connect(self._shortcut_proxy(self._on_add_instance_clicked))
self.shortcut_settings = QShortcut(QKeySequence(_("Ctrl+K")), self)
self.shortcut_settings.activated.connect(self._shortcut_proxy(self._show_settings))
self.shortcut_menu = QShortcut(QKeySequence(_("Alt+E")), self)
self.shortcut_menu.activated.connect(self._shortcut_proxy(self._show_menu))
self.shortcut_help = QShortcut(QKeySequence(QKeySequence.HelpContents), self)
self.shortcut_help.activated.connect(self._shortcut_proxy(self._on_show_doc_clicked))
self.shortcut_quit = QShortcut(QKeySequence(QKeySequence.Quit), self)
self.shortcut_quit.activated.connect(self._shortcut_proxy(self.close_app))
self.shortcut_create_org = QShortcut(QKeySequence(QKeySequence.New), self)
self.shortcut_create_org.activated.connect(
self._shortcut_proxy(self._on_create_org_clicked)
)
self.shortcut_join_org = QShortcut(QKeySequence(QKeySequence.Open), self)
self.shortcut_join_org.activated.connect(self._shortcut_proxy(self._on_join_org_clicked))
shortcut = QShortcut(QKeySequence(QKeySequence.NextChild), self)
shortcut.activated.connect(self._shortcut_proxy(self._cycle_tabs(1)))
shortcut = QShortcut(QKeySequence(QKeySequence.PreviousChild), self)
shortcut.activated.connect(self._shortcut_proxy(self._cycle_tabs(-1)))
示例3: _init_ui
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def _init_ui(self):
self.resize(1200, 800)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
layout = QtWidgets.QVBoxLayout(self)
self._init_header(layout)
self._init_canvas(layout)
self._init_controls(layout)
self._init_footer(layout)
events = (
(QtGui.QKeySequence.Undo, self.on_undo),
(QtGui.QKeySequence.Save, self.on_save_quit),
(QtGui.QKeySequence.Quit, self.close),
(QtGui.QKeySequence.MoveToNextChar, self.increment_vertical_nav),
(QtGui.QKeySequence.MoveToPreviousChar, self.decrement_vertical_nav),
(QtGui.QKeySequence.MoveToNextLine, self.increment_horizontal_nav),
(QtGui.QKeySequence.MoveToPreviousLine, self.decrement_horizontal_nav)
)
for event, action in events:
QtWidgets.QShortcut(event, self, action)
self.setWindowTitle(self.params.dialog_title)
示例4: set_shortcuts
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def set_shortcuts(self):
year_move_right = QtWidgets.QShortcut(
QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_Right), self)
year_move_right.activated.connect(lambda: self.move_slider(self.year_step))
year_move_left = QtWidgets.QShortcut(
QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_Left), self)
year_move_left.activated.connect(lambda: self.move_slider(-self.year_step))
month_move_right = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Right), self)
month_move_right.activated.connect(lambda: self.move_slider(1))
month_move_left = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Left), self)
month_move_left.activated.connect(lambda: self.move_slider(-1))
示例5: init_action
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def init_action(self):
zoom_minus = QShortcut(QKeySequence("Ctrl+-"), self)
zoom_minus.activated.connect(self.minus)
zoom_plus = QShortcut(QKeySequence("Ctrl+="), self)
zoom_plus.activated.connect(self.plus)
switch_left = QShortcut(QKeySequence(Qt.Key_Left), self)
switch_left.activated.connect(self.left)
switch_right = QShortcut(QKeySequence(Qt.Key_Right), self)
switch_right.activated.connect(self.right)
'''
a1 = QAction(self)
a1.setShortcut('Ctrl++')
self.addAction(a1)
a1.triggered.connect(self.plus)
a2 = QAction(self)
a2.setShortcut('Ctrl+-')
self.addAction(a2)
a2.triggered.connect(self.minus)
'''
示例6: initUI
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def initUI(self):
self.setWindowTitle('Annotations')
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Shift+/"), self, self.close, self.close)
示例7: initUI
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def initUI(self):
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("/"), self, self.close, self.close)
self.ui.pushButton.clicked.connect(self.onClicked)
width = self.ui.size().width() + 15
height = self.ui.size().height() + 15
self.setFixedSize(width, height)
示例8: generate_keyboard_shortcuts
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def generate_keyboard_shortcuts(self):
ksNextChapter = QtWidgets.QShortcut(
QtGui.QKeySequence('Right'), self.contentView)
ksNextChapter.setObjectName('nextChapter')
ksNextChapter.activated.connect(self.sneaky_change)
ksPrevChapter = QtWidgets.QShortcut(
QtGui.QKeySequence('Left'), self.contentView)
ksPrevChapter.setObjectName('prevChapter')
ksPrevChapter.activated.connect(self.sneaky_change)
ksGoFullscreen = QtWidgets.QShortcut(
QtGui.QKeySequence('F'), self.contentView)
ksGoFullscreen.activated.connect(self.go_fullscreen)
ksExitFullscreen = QtWidgets.QShortcut(
QtGui.QKeySequence('Escape'), self.contentView)
ksExitFullscreen.setContext(QtCore.Qt.ApplicationShortcut)
ksExitFullscreen.activated.connect(self.exit_fullscreen)
ksToggleBookmarks = QtWidgets.QShortcut(
QtGui.QKeySequence('Ctrl+B'), self.contentView)
ksToggleBookmarks.activated.connect(
lambda: self.toggle_side_dock(0))
# Shortcuts not required for comic view functionality
if not self.are_we_doing_images_only:
ksToggleAnnotations = QtWidgets.QShortcut(
QtGui.QKeySequence('Ctrl+N'), self.contentView)
ksToggleAnnotations.activated.connect(
lambda: self.toggle_side_dock(1))
ksToggleSearch = QtWidgets.QShortcut(
QtGui.QKeySequence('Ctrl+F'), self.contentView)
ksToggleSearch.activated.connect(
lambda: self.toggle_side_dock(2))
示例9: initUI
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def initUI(self):
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("F4"), self, self.close, self.close)
#QtCore.QObject.connect(self.ui.ok, QtCore.SIGNAL('clicked()'), self.onClicked)
示例10: initUI
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def initUI(self):
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Alt+G"), self, self.close, self.close)
self.ui.setWindowTitle('GoTo')
self.ui.lineEdit.returnPressed.connect(lambda: self.onReturnPressed())
示例11: initUI
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def initUI(self):
self.setWindowTitle('Annotations')
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Shift+/"), self, self.close, self.close)
示例12: registerShortcuts
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def registerShortcuts(self, parent):
self._parent = parent
self.w = WHeaders(parent, self)
self._writeData(self.w)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Alt+P"), parent, self._showit, self._showit)
self.g = MyDialogGoto(parent, self)
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("Alt+G"), parent, self._g_showit, self._g_showit)]
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("F3"), parent, self.F3, self.F3)]
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("["), parent, self.skip_section_dw, self.skip_section_dw)]
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("]"), parent, self.skip_section_up, self.skip_section_up)]
示例13: initUI
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def initUI(self):
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Alt+P"), self, self.close, self.close)
示例14: registerShortcuts
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def registerShortcuts(self, parent):
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("Alt+P"), parent, self.showPermissions, self.showPermissions)]
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("Alt+E"), parent, self.showEntrypoints, self.showEntrypoints)]
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("Alt+F"), parent, self.showFiles, self.showFiles)]
self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("Alt+G"), parent, self._g_showit, self._g_showit)]
return
示例15: initUI
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QShortcut [as 别名]
def initUI(self):
self.setWindowTitle('APK plugin')
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Alt+F"), self, self.close, self.close)