本文整理汇总了Python中PyQt5.QtCore.Qt.ALT属性的典型用法代码示例。如果您正苦于以下问题:Python Qt.ALT属性的具体用法?Python Qt.ALT怎么用?Python Qt.ALT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.ALT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: key_event_sequence
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ALT [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)
示例2: onKeyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ALT [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()
示例3: init
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ALT [as 别名]
def init(self):
self.setUtf8(True)
lexer = QsciLexerJSON(self)
self.setLexer(lexer)
self.setAutoCompletionCaseSensitivity(False) # 忽略大小写
self.setAutoCompletionSource(self.AcsAll)
self.setAutoCompletionThreshold(1) # 一个字符就弹出补全
self.setAutoIndent(True) # 自动缩进
self.setBackspaceUnindents(True)
self.setBraceMatching(self.StrictBraceMatch)
self.setIndentationGuides(True)
self.setIndentationsUseTabs(False)
self.setIndentationWidth(4)
self.setTabIndents(True)
self.setTabWidth(4)
self.setWhitespaceSize(1)
self.setWhitespaceVisibility(self.WsVisible)
self.setWhitespaceForegroundColor(Qt.gray)
self.setWrapIndentMode(self.WrapIndentFixed)
self.setWrapMode(self.WrapWord)
# 折叠
self.setFolding(self.BoxedTreeFoldStyle, 2)
self.setFoldMarginColors(QColor("#676A6C"), QColor("#676A6D"))
font = self.font() or QFont()
font.setFamily("Consolas")
font.setFixedPitch(True)
font.setPointSize(13)
self.setFont(font)
self.setMarginsFont(font)
self.fontmetrics = QFontMetrics(font)
lexer.setFont(font)
self.setMarginWidth(0, self.fontmetrics.width(str(self.lines())) + 6)
self.setMarginLineNumbers(0, True)
self.setMarginsBackgroundColor(QColor("gainsboro"))
self.setMarginWidth(1, 0)
self.setMarginWidth(2, 14) # 折叠区域
# 绑定自动补齐热键Alt+/
completeKey = QShortcut(QKeySequence(Qt.ALT + Qt.Key_Slash), self)
completeKey.setContext(Qt.WidgetShortcut)
completeKey.activated.connect(self.autoCompleteFromAll)
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ALT [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()