Python PyQt5.QtCore.Qt 模块,Key_Enter() 实例源码

我们从Python开源项目中,提取了以下20个代码示例,用于说明如何使用PyQt5.QtCore.Qt.Key_Enter()

项目:QtPropertyBrowserV2.6-for-pyqt5    作者:theall    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        if event.key() in [Qt.Key_Return, Qt.Key_Enter, Qt.Key_Space]:## Trigger Edit
            if (not self.m_editorPrivate.editedItem()):
                item = self.currentItem()
                if item:
                    if (item.columnCount() >= 2 and ((item.flags() & (Qt.ItemIsEditable | Qt.ItemIsEnabled)) == (Qt.ItemIsEditable | Qt.ItemIsEnabled))):
                        event.accept()
                        ## If the current position is at column 0, move to 1.
                        index = self.currentIndex()
                        if (index.column() == 0):
                            index = index.sibling(index.row(), 1)
                            self.setCurrentIndex(index)
                        self.edit(index)
                        return

        super(QtPropertyEditorView, self).keyPressEvent(event)
项目:QtPropertyBrowserV2.6-for-pyqt5    作者:theall    | 项目源码 | 文件源码
def eventFilter(self, obj, ev):
        if (obj == self.m_button):
            k = ev.type()
            if k in [QEvent.KeyPress, QEvent.KeyRelease]:# Prevent the QToolButton from handling Enter/Escape meant control the delegate
                x = ev.key()
                if x in [Qt.Key_Escape, Qt.Key_Enter, Qt.Key_Return]:
                    ev.ignore()
                    return True

        return super(QtColorEditWidget, self).eventFilter(obj, ev)
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        pressedkey = event.key()
        if ((pressedkey == Qt.Key_Up or pressedkey == Qt.Key_Down)
                and int(app.keyboardModifiers()) == Qt.NoModifier):
            super(CommentListView, self).keyPressEvent(event)
        elif pressedkey == Qt.Key_Delete:
            deleteSelection()
            event.accept()
        elif pressedkey == Qt.Key_Enter or pressedkey == Qt.Key_Return:
            editSelection()
            event.accept()
        elif pressedkey == Qt.Key_C and int(app.keyboardModifiers()) == Qt.CTRL:
            copySelection()
            event.accept()
        else:
            event.ignore()
项目:uPyLoader    作者:BetaRavener    | 项目源码 | 文件源码
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.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()
项目:QtPropertyBrowserV2.6-for-pyqt5    作者:theall    | 项目源码 | 文件源码
def eventFilter(self, obj, ev):
        if (obj == self.m_button):
            k = ev.type()
            if k in [QEvent.KeyPress, QEvent.KeyRelease]:# Prevent the QToolButton from handling Enter/Escape meant control the delegate
                x = ev.key()
                if x in [Qt.Key_Escape, Qt.Key_Enter, Qt.Key_Return]:
                    ev.ignore()
                    return True

        return super(QtFontEditWidget, self).eventFilter(obj, ev)
项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
def keyPressEvent(self, event: QKeyEvent) -> None:
        if event.key() in (Qt.Key_Enter, Qt.Key_Return):
            return
        super(Settings, self).keyPressEvent(event)
项目:AlphaHooks    作者:AlphaHooks    | 项目源码 | 文件源码
def eventFilter(self, source, event):

        # Console Input
        if source is self.ui.console_input:
            if event.type() == QEvent.KeyPress:
                if event.key() in (Qt.Key_Enter, Qt.Key_Return):
                    command = self.ui.console_input.text()
                    if command != "":
                        readline.add_history(
                            command
                        )
                    self.length = readline.get_current_history_length()
                    self.index = -1

                if event.key() == Qt.Key_Up:
                    if self.index < self.length:
                        self.index += 1
                        command = readline.get_history_item(
                            self.length - self.index
                        )
                        self.ui.console_input.setText(
                            command
                        )

                if event.key() == Qt.Key_Down:
                    if self.index > 0:
                        self.index -= 1
                        command = readline.get_history_item(
                            self.length - self.index
                        )

                        self.ui.console_input.setText(
                            command
                        )

            return False
        return False
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
            commentlistview.delegate.commitData.emit(self)
            commentlistview.delegate.closeEditor.emit(self)
            event.accept()
        else:
            super(CommentTextEdit, self).keyPressEvent(event)
项目:cookiecutter-pyqt5    作者:mandeep    | 项目源码 | 文件源码
def test_open_file(window, qtbot, mock):
    """Test the Open File item of the File submenu.

    Qtbot clicks on the file sub menu and then navigates to the Open File item. Mock creates
    an object to be passed to the QFileDialog.
    """
    qtbot.mouseClick(window.file_sub_menu, Qt.LeftButton)
    qtbot.keyClick(window.file_sub_menu, Qt.Key_Down)
    mock.patch.object(QFileDialog, 'getOpenFileName', return_value=('', ''))
    qtbot.keyClick(window.file_sub_menu, Qt.Key_Enter)
项目:cookiecutter-pyqt5    作者:mandeep    | 项目源码 | 文件源码
def test_about_dialog(window, qtbot, mock):
    """Test the About item of the Help submenu.

    Qtbot clicks on the help sub menu and then navigates to the About item. Mock creates
    a QDialog object to be used for the test.
    """
    qtbot.mouseClick(window.help_sub_menu, Qt.LeftButton)
    qtbot.keyClick(window.help_sub_menu, Qt.Key_Down)
    mock.patch.object(QDialog, 'exec_', return_value='accept')
    qtbot.keyClick(window.help_sub_menu, Qt.Key_Enter)
项目:COMTool    作者:Neutree    | 项目源码 | 文件源码
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()
        return
项目:chronophore    作者:mesbahamin    | 项目源码 | 文件源码
def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close()
        if e.key() == Qt.Key_Return or e.key() == Qt.Key_Enter:
            self._sign_button_press()
项目:udpsocket-gobang    作者:gzdaijie    | 项目源码 | 文件源码
def keyPressEvent(self,event):
        key = event.key()
        if key == Qt.Key_Enter or key == Qt.Key_Return:
            self.chat()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def keyPressEvent(self, e):
        completion_prefix = self.text_under_cursor()
        if self.cmp and self.popup_widget.func_list_widget.isVisible():
            current_row = self.popup_widget.func_list_widget.currentRow()
            if e.key() == Qt.Key_Down:
                self.current_item_down(current_row)
                return

            if e.key() == Qt.Key_Up:
                self.current_item_up(current_row)
                return

            if e.key() in (Qt.Key_Return, Qt.Key_Enter):
                selected_word = self.popup_widget.func_list_widget.currentItem().text()
                self.insert_func_name_signal.emit(completion_prefix, selected_word)
                return

        if e.key() in (Qt.Key_Return, Qt.Key_Enter):
            self.parse_content()

        is_shortcut = ((e.modifiers() & Qt.ControlModifier) and e.key() == Qt.Key_E)  # shortcut key:ctrl + e
        if is_shortcut:
            self.cmp.update("", self.popup_widget)
            self.update_popup_widget_position()
            self.activateWindow()
            return

        if not self.cmp or not is_shortcut:
            super(TextEdit, self).keyPressEvent(e)
项目:DCheat    作者:DCheat    | 项目源码 | 文件源码
def keyPressEvent(self, QKeyEvent):
        if QKeyEvent.key() == Qt.Key_Escape:
            pass

        if QKeyEvent.key() == Qt.Key_Enter or QKeyEvent.key() == Qt.Key_Return:
            self.slot_login()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def test_analyze_button_enocean(self):
        self.add_signal_to_form("enocean.complex")
        w = self.form.signal_tab_controller.signal_frames[1].ui.spinBoxCenterOffset
        w.setValue(0)
        QTest.keyClick(w, Qt.Key_Enter)
        w = self.form.signal_tab_controller.signal_frames[1].ui.spinBoxNoiseTreshold
        w.setValue(0.0111)
        QTest.keyClick(w, Qt.Key_Enter)
        self.cfc.ui.btnAnalyze.click()
        self.assertTrue(True)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def keyPressEvent(self, event: QKeyEvent):
        if event.key() in (Qt.Key_Enter, Qt.Key_Return):
            selected = [index.row() for index in self.selectedIndexes()]
            if len(selected) > 0:
                self.edit_on_item_triggered.emit(min(selected))
        else:
            super().keyPressEvent(event)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def keyPressEvent(self, event: QKeyEvent):
        if event.key() == Qt.Key_Enter:
            event.ignore()
        else:
            event.accept()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def keyPressEvent(self, event: QKeyEvent):
        if event.key() == Qt.Key_Enter or event.key() == Qt.Key_Return:
            return
        else:
            super().keyPressEvent(event)
项目:songscreen    作者:maccesch    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape and self.isFullScreen():
            self.setFullScreen(False)
            event.accept()
        elif event.key() == Qt.Key_Enter and event.modifiers() & Qt.Key_Alt:
            self.setFullScreen(not self.isFullScreen())
            event.accept()
        else:
            super(VideoWidget, self).keyPressEvent(event)