当前位置: 首页>>代码示例>>Python>>正文


Python Qt.Key_Return方法代码示例

本文整理汇总了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) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:20,代码来源:command.py

示例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 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:22,代码来源:keyutils.py

示例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() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:31,代码来源:settings.py

示例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) 
开发者ID:teemu-l,项目名称:execution-trace-viewer,代码行数:8,代码来源:filter_widget.py

示例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 
开发者ID:Ultimaker,项目名称:Uranium,代码行数:33,代码来源:QtKeyDevice.py

示例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() 
开发者ID:Neutree,项目名称:COMTool,代码行数:14,代码来源:Main.py

示例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() 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:6,代码来源:claim_user_widget.py

示例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() 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:6,代码来源:claim_device_widget.py

示例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() 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:6,代码来源:custom_dialogs.py

示例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() 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:6,代码来源:login_widget.py

示例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 
开发者ID:CountryTk,项目名称:Hydra,代码行数:11,代码来源:TextEditor.py

示例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) 
开发者ID:TUDelft-CNS-ATM,项目名称:bluesky,代码行数:11,代码来源:textclient.py

示例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()) 
开发者ID:hustlei,项目名称:QssStylesheetEditor,代码行数:12,代码来源:mainwin.py

示例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() 
开发者ID:iGio90,项目名称:Dwarf,代码行数:6,代码来源:dialog_list.py

示例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) 
开发者ID:iGio90,项目名称:Dwarf,代码行数:41,代码来源:widget_console.py


注:本文中的PyQt5.QtCore.Qt.Key_Return方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。