本文整理汇总了Python中PyQt5.QtCore.Qt.CTRL属性的典型用法代码示例。如果您正苦于以下问题:Python Qt.CTRL属性的具体用法?Python Qt.CTRL怎么用?Python Qt.CTRL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.CTRL属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: left
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CTRL [as 别名]
def left(self):
self.widget.switch_page(right=False)
#def keyPressEvent(self, event):
#这里event.key()显示的是按键的编码
#print("按下:" + str(event.key()))
# 举例,这里Qt.Key_A注意虽然字母大写,但按键事件对大小写不敏感
#if (event.key() == Qt.Key_Left):
# self.widget.switch_page(right=False)
#elif (event.key() == Qt.Key_Right):
# self.widget.switch_page(right=True)
#elif (event.modifiers() == Qt.CTRL and event.key() == Qt.Key_Plus):
# self.widget.zoom_book(plus=True)
#elif (event.modifiers() == Qt.CTRL and event.key() == Qt.Key_Minus):
# self.widget.zoom_book(plus=False)
示例2: key_event_sequence
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CTRL [as 别名]
def key_event_sequence(event):
val = event.key()
mod = event.modifiers()
if mod & Qt.ShiftModifier:
val += Qt.SHIFT
if mod & Qt.ControlModifier:
val += Qt.CTRL
if mod & Qt.AltModifier:
val += Qt.ALT
if mod & Qt.MetaModifier:
val += Qt.META
return QKeySequence(val)
示例3: onKeyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CTRL [as 别名]
def onKeyPressEvent(self, e):
if not e.isAutoRepeat():
keys = e.key()
modifiers = e.modifiers()
if modifiers & Qt.ShiftModifier:
keys += Qt.SHIFT
if modifiers & Qt.ControlModifier:
keys += Qt.CTRL
if modifiers & Qt.AltModifier:
keys += Qt.ALT
if modifiers & Qt.MetaModifier:
keys += Qt.META
if QKeySequence(keys) in self._go_key_sequence:
self.go()
elif e.key() == Qt.Key_Space:
if qApp.keyboardModifiers() == Qt.ShiftModifier:
cue = self.current_cue()
if cue is not None:
self.edit_cue(cue)
elif qApp.keyboardModifiers() == Qt.ControlModifier:
item = self.current_item()
if item is not None:
item.selected = not item.selected
else:
self.key_pressed.emit(e)
e.accept()
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CTRL [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.context_menu_pos = None # type: QPoint
self.copy_action = QAction("Copy selection", self)
self.copy_action.setShortcut(QKeySequence.Copy)
self.copy_action.setIcon(QIcon.fromTheme("edit-copy"))
self.copy_action.triggered.connect(self.on_copy_action_triggered)
self.use_header_colors = False
self.original_font_size = self.font().pointSize()
self.original_header_font_sizes = {"vertical": self.verticalHeader().font().pointSize(),
"horizontal": self.horizontalHeader().font().pointSize()}
self.zoom_in_action = QAction(self.tr("Zoom in"), self)
self.zoom_in_action.setShortcut(QKeySequence.ZoomIn)
self.zoom_in_action.triggered.connect(self.on_zoom_in_action_triggered)
self.zoom_in_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.zoom_in_action.setIcon(QIcon.fromTheme("zoom-in"))
self.addAction(self.zoom_in_action)
self.zoom_out_action = QAction(self.tr("Zoom out"), self)
self.zoom_out_action.setShortcut(QKeySequence.ZoomOut)
self.zoom_out_action.triggered.connect(self.on_zoom_out_action_triggered)
self.zoom_out_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.zoom_out_action.setIcon(QIcon.fromTheme("zoom-out"))
self.addAction(self.zoom_out_action)
self.zoom_original_action = QAction(self.tr("Zoom original"), self)
self.zoom_original_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_0))
self.zoom_original_action.triggered.connect(self.on_zoom_original_action_triggered)
self.zoom_original_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.zoom_original_action.setIcon(QIcon.fromTheme("zoom-original"))
self.addAction(self.zoom_original_action)
self.horizontalHeader().setMinimumSectionSize(0)
示例5: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CTRL [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.context_menu_position = None # type: QPoint
self.scene_type = 0
self.auto_fit_on_resize_is_blocked = False
self.zoom_in_action = QAction(self.tr("Zoom in"), self)
self.zoom_in_action.setShortcut(QKeySequence.ZoomIn)
self.zoom_in_action.triggered.connect(self.on_zoom_in_action_triggered)
self.zoom_in_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.zoom_in_action.setIcon(QIcon.fromTheme("zoom-in"))
self.addAction(self.zoom_in_action)
self.zoom_out_action = QAction(self.tr("Zoom out"), self)
self.zoom_out_action.setShortcut(QKeySequence.ZoomOut)
self.zoom_out_action.triggered.connect(self.on_zoom_out_action_triggered)
self.zoom_out_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.zoom_out_action.setIcon(QIcon.fromTheme("zoom-out"))
self.addAction(self.zoom_out_action)
self.zoom_original_action = QAction(self.tr("Zoom original"), self)
self.zoom_original_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_0))
self.zoom_original_action.triggered.connect(self.on_zoom_original_action_triggered)
self.zoom_original_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.zoom_original_action.setIcon(QIcon.fromTheme("zoom-original"))
self.addAction(self.zoom_original_action)
self.redraw_timer = QTimer(self)
self.redraw_timer.setSingleShot(True)
self.redraw_timer.timeout.connect(self.redraw_view)
self.zoomed.connect(self.on_signal_zoomed)
self.scene_x_zoom_stretch = 1
示例6: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CTRL [as 别名]
def __init__(self, parent=None, plugins=None, fullscreen=False):
super(DeenGui, self).__init__(parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.plugins = plugins
self.widgets = []
self.ui.actionLoad_from_file.triggered.connect(self.load_from_file)
self.ui.actionQuit.triggered.connect(QApplication.quit)
self.ui.actionAbout.triggered.connect(self.show_about)
self.ui.actionStatus_console.triggered.connect(self.show_status_console)
self.ui.actionTop_to_bottom.triggered.connect(self.set_widget_direction_toptobottom)
self.ui.actionLeft_to_right.triggered.connect(self.set_widget_direction_lefttoright)
# Set default direction
self.set_widget_direction_toptobottom()
self.ui.actionCopy_to_clipboard.triggered.connect(self.copy_content_to_clipboard)
self.ui.actionSave_content_to_file.triggered.connect(self.save_widget_content_to_file)
self.ui.actionSearch.triggered.connect(self.toggle_search_box_visibility)
self.widgets.append(DeenEncoderWidget(self))
for widget in self.widgets:
self.ui.encoder_widget_layout.addWidget(widget)
self.load_from_file_dialog = QFileDialog(self)
self.setWindowTitle('deen')
self.log = DeenLogger(self)
self.widgets[0].set_field_focus()
# Add action fuzzy search
self.fuzzy_search_ui = FuzzySearchUi(self)
self.fuzzy_search_action_shortcut = QShortcut(QKeySequence(Qt.CTRL | Qt.Key_R), self)
self.fuzzy_search_action_shortcut.activated.connect(self.fuzzy_search_action)
self.clear_current_widget_shortcut = QShortcut(QKeySequence(Qt.CTRL | Qt.Key_Q), self)
self.clear_current_widget_shortcut.activated.connect(self.clear_current_widget)
self.hide_search_box_shortcut = QShortcut(QKeySequence(Qt.CTRL | Qt.Key_F), self)
self.hide_search_box_shortcut.activated.connect(self.toggle_search_box_visibility)
self.next_encoder_widget_shortcut = QShortcut(QKeySequence(Qt.ALT | Qt.Key_Right), self)
self.next_encoder_widget_shortcut.activated.connect(self.toggle_next_encoder_focus)
self.prev_encoder_widget_shortcut = QShortcut(QKeySequence(Qt.ALT | Qt.Key_Left), self)
self.prev_encoder_widget_shortcut.activated.connect(self.toggle_prev_encoder_focus)
if fullscreen:
self.showMaximized()
self.show()