本文整理汇总了Python中PyQt5.QtCore.Qt.Key_Return方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Key_Return方法的具体用法?Python Qt.Key_Return怎么用?Python Qt.Key_Return使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Key_Return方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, e: QKeyEvent) -> None:
"""Override keyPressEvent to ignore Return key presses.
If this widget is focused, we are in passthrough key mode, and
Enter/Shift+Enter/etc. will cause QLineEdit to think it's finished
without command_accept to be called.
"""
text = self.text()
if text in modeparsers.STARTCHARS and e.key() == Qt.Key_Backspace:
e.accept()
modeman.leave(self._win_id, usertypes.KeyMode.command,
'prefix deleted')
return
if e.key() == Qt.Key_Return:
e.ignore()
return
else:
super().keyPressEvent(e)
示例2: text
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def text(self) -> str:
"""Get the text which would be displayed when pressing this key."""
control = {
Qt.Key_Space: ' ',
Qt.Key_Tab: '\t',
Qt.Key_Backspace: '\b',
Qt.Key_Return: '\r',
Qt.Key_Enter: '\r',
Qt.Key_Escape: '\x1b',
}
if self.key in control:
return control[self.key]
elif not _is_printable(self.key):
return ''
text = QKeySequence(self.key).toString()
if not self.modifiers & Qt.ShiftModifier: # type: ignore[operator]
text = text.lower()
return text
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def __init__(self):
self.version = 100 # Assume oldest config
self.root_dir = QDir().currentPath()
self.send_sleep = 0.1
self.read_sleep = 0.1
self.use_transfer_scripts = True
self.use_custom_transfer_scripts = False
self.external_transfer_scripts_folder = None
self.wifi_presets = []
self.python_flash_executable = None
self.last_firmware_directory = None
self.debug_mode = False
self._geometries = {}
self.external_editor_path = None
self.external_editor_args = None
self.new_line_key = QKeySequence(Qt.SHIFT + Qt.Key_Return, Qt.SHIFT + Qt.Key_Enter)
self.send_key = QKeySequence(Qt.Key_Return, Qt.Key_Enter)
self.terminal_tab_spaces = 4
self.mpy_cross_path = None
self.preferred_port = None
self.auto_transfer = False
if not self.load():
if not self.load_old():
# No config found, init at newest version
self.version = Settings.newest_version
return
self._update_config()
示例4: on_filter_combo_box_key_pressed
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def on_filter_combo_box_key_pressed(self, event):
"""Checks if enter is pressed on filterEdit"""
key = event.key()
if key in (Qt.Key_Return, Qt.Key_Enter):
self.on_filter_btn_clicked()
QComboBox.keyPressEvent(self.filter_combo_box, event)
示例5: _qtKeyToUMKey
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def _qtKeyToUMKey(self, key):
if key == Qt.Key_Shift:
return KeyEvent.ShiftKey
elif key == Qt.Key_Control:
return KeyEvent.ControlKey
elif key == Qt.Key_Alt:
return KeyEvent.AltKey
elif key == Qt.Key_Space:
return KeyEvent.SpaceKey
elif key == Qt.Key_Meta:
return KeyEvent.MetaKey
elif key == Qt.Key_Enter or key == Qt.Key_Return:
return KeyEvent.EnterKey
elif key == Qt.Key_Up:
return KeyEvent.UpKey
elif key == Qt.Key_Down:
return KeyEvent.DownKey
elif key == Qt.Key_Left:
return KeyEvent.LeftKey
elif key == Qt.Key_Right:
return KeyEvent.RightKey
elif key == Qt.Key_Minus:
return KeyEvent.MinusKey
elif key == Qt.Key_Underscore:
return KeyEvent.UnderscoreKey
elif key == Qt.Key_Plus:
return KeyEvent.PlusKey
elif key == Qt.Key_Equal:
return KeyEvent.EqualKey
return key
示例6: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Control:
self.keyControlPressed = True
elif event.key() == Qt.Key_Return or event.key()==Qt.Key_Enter:
if self.keyControlPressed:
self.sendData()
elif event.key() == Qt.Key_L:
if self.keyControlPressed:
self.sendArea.clear()
elif event.key() == Qt.Key_K:
if self.keyControlPressed:
self.receiveArea.clear()
示例7: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Return and not self.claim_user_job:
self.claim_clicked()
event.accept()
示例8: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Return and not self.claim_device_job:
self.claim_clicked()
event.accept()
示例9: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Return:
self._on_button_clicked()
event.accept()
示例10: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
if event.key() == Qt.Key_Return:
self.try_login()
event.accept()
示例11: keyReleaseEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyReleaseEvent(self, e):
if e.key() == Qt.Key_Return:
try:
self.updateAutoComplete(self.parent.fileName)
except AttributeError as E:
print(E, "on line 210 in TextEditor.py")
if e.key() == Qt.Key_Backspace:
pass
示例12: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
''' Handle Enter keypress to send a command to BlueSky. '''
if event.key() == Qt.Key_Enter or event.key() == Qt.Key_Return:
if bsclient is not None:
bsclient.stack(self.toPlainText())
echobox.echo(self.toPlainText())
self.setText('')
else:
super().keyPressEvent(event)
示例13: textChanged
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def textChanged(self, e): # QKeyEvent(QEvent.KeyPress, Qt.Key_Enter, Qt.NoModifier)
# if (32<e.key()<96 or 123<e.key()<126 or 0x1000001<e.key()<0x1000005 or e.key==Qt.Key_Delete):
# 大键盘为Ret小键盘为Enter
if (e.key() in (Qt.Key_Return, Qt.Key_Enter, Qt.Key_Semicolon, Qt.Key_BraceRight, Qt.Key_Up, Qt.Key_Down,
Qt.Key_Left, Qt.Key_Right, Qt.Key_Tab, Qt.Key_Delete, Qt.Key_Backspace)):
self.renderStyle()
self.loadColorPanel()
self.actions["undo"].setEnabled(self.editor.isUndoAvailable())
self.actions["redo"].setEnabled(self.editor.isRedoAvailable())
示例14: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
super(ListDialog, self).keyPressEvent(event)
if event.key() == Qt.Key_Return:
self.accept()
示例15: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_Return [as 别名]
def keyPressEvent(self, event):
# when codecompletion popup dont respond to enter
if self.completer and self.completer.popup() and self.completer.popup(
).isVisible():
event.ignore()
return super().keyPressEvent(event)
if event.key() == Qt.Key_Enter or event.key() == Qt.Key_Return:
cmd = self.toPlainText()
l = len(self.cmds)
if l > 0:
if l > 100:
self.cmds.pop(0)
if cmd != self.cmds[l - 1]:
self.cmds.append(cmd)
else:
self.cmds.append(cmd)
self.cmd_index = 0
self.onEnterKeyPressed.emit(cmd)
self.setPlainText('')
elif event.key() == Qt.Key_Up:
l = len(self.cmds)
try:
self.setPlainText(self.cmds[l - 1 - self.cmd_index])
if self.cmd_index < l - 1:
self.cmd_index += 1
except:
pass
elif event.key() == Qt.Key_Down:
try:
if self.cmd_index >= 0:
self.cmd_index -= 1
self.setPlainText(
self.cmds[len(self.cmds) - 1 - self.cmd_index])
except:
self.setPlainText('')
self.cmd_index = 0
else:
return super().keyPressEvent(event)