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

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

项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def set_up_keyboard_symbols_keys(self):
        row_1 = [Qt.Key_BracketLeft, Qt.Key_BracketRight, Qt.Key_BraceLeft,
                 Qt.Key_BraceRight, Qt.Key_Aring, Qt.Key_Percent,
                 Qt.Key_Dead_Circumflex, Qt.Key_Asterisk, Qt.Key_Plus,
                 Qt.Key_Equal, Qt.Key_Backspace]

        row_2 = [Qt.Key_Underscore, Qt.Key_Backslash, Qt.Key_Aring,
                 Qt.Key_Dead_Tilde, Qt.Key_Less, Qt.Key_Greater,
                 Qt.Key_Aring, Qt.Key_Aring, Qt.Key_Aring, Qt.Key_Return]

        row_3 = [Qt.Key_Aring, Qt.Key_Period, Qt.Key_Comma, Qt.Key_Question,
                 Qt.Key_Exclam, Qt.Key_QuoteLeft, Qt.Key_QuoteDbl,
                 Qt.Key_Aring]

        row_4 = [Qt.Key_Aring, Qt.Key_Space, Qt.Key_Aring, Qt.Key_Aring]

        self.keyboard_symbols_keys = [row_1, row_2, row_3, row_4]
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def set_up_keyboard_keys(self):

        row_1 = [Qt.Key_Q, Qt.Key_W, Qt.Key_E, Qt.Key_R, Qt.Key_T, Qt.Key_Y,
                 Qt.Key_Y, Qt.Key_I, Qt.Key_O, Qt.Key_P, Qt.Key_Backspace]
        row_2 = [Qt.Key_A, Qt.Key_S, Qt.Key_D, Qt.Key_F, Qt.Key_G, Qt.Key_H,
                 Qt.Key_J, Qt.Key_K, Qt.Key_L, Qt.Key_Ccedilla, Qt.Key_Return]
        row_3 = [Qt.Key_Aring, Qt.Key_Z, Qt.Key_X, Qt.Key_C, Qt.Key_V,
                 Qt.Key_B, Qt.Key_N, Qt.Key_M, Qt.Key_Comma, Qt.Key_Period,
                 Qt.Key_Question, Qt.Key_Aring]
        row_4 = [Qt.Key_Aring, Qt.Key_Space,
                 Qt.Key_Left, Qt.Key_Right, Qt.Key_Aring]
        self.keyboard_keys = [row_1, row_2, row_3, row_4]
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def set_up_keyboard_numbers_keys(self):
        row_1 = [Qt.Key_1, Qt.Key_2, Qt.Key_3, Qt.Key_4, Qt.Key_5, Qt.Key_6,
                 Qt.Key_7, Qt.Key_8, Qt.Key_9, Qt.Key_0, Qt.Key_Backspace]

        row_2 = [Qt.Key_Minus, Qt.Key_Slash, Qt.Key_Colon, Qt.Key_Semicolon,
                 Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_Dollar,
                 Qt.Key_Ampersand, Qt.Key_At, Qt.Key_Return]

        row_3 = [Qt.Key_Aring, Qt.Key_Period, Qt.Key_Comma, Qt.Key_Question,
                 Qt.Key_Exclam, Qt.Key_QuoteLeft, Qt.Key_QuoteDbl,
                 Qt.Key_Aring]

        row_4 = [Qt.Key_Aring, Qt.Key_Space, Qt.Key_Aring, Qt.Key_Aring]

        self.keyboard_numbers_keys = [row_1, row_2, row_3, row_4]
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        key = event.key()
        if key == Qt.Key_Return:
            cursor = self.textCursor()
            indentLvl = self.findLineIndentLevel()
            if self.openBlockDelimiter is not None:
                cursor.movePosition(QTextCursor.PreviousCharacter,
                                    QTextCursor.KeepAnchor)
                if cursor.selectedText() == self.openBlockDelimiter:
                    indentLvl += 1
            super(BaseCodeEditor, self).keyPressEvent(event)
            newLineSpace = "".join(self._indent for _ in range(indentLvl))
            cursor = self.textCursor()
            cursor.insertText(newLineSpace)
        elif key in (Qt.Key_Backspace, Qt.Key_Backtab):
            cursor = self.textCursor()
            if key == Qt.Key_Backtab and cursor.hasSelection():
                self.performLinewiseIndent(cursor, False)
            else:
                cursor.movePosition(QTextCursor.PreviousCharacter,
                                    QTextCursor.KeepAnchor,
                                    len(self._indent))
                if cursor.selectedText() == self._indent:
                    cursor.removeSelectedText()
                else:
                    super(BaseCodeEditor, self).keyPressEvent(event)
        elif key == Qt.Key_Tab:
            cursor = self.textCursor()
            if cursor.hasSelection():
                self.performLinewiseIndent(cursor)
            else:
                cursor.insertText(self._indent)
        else:
            super(BaseCodeEditor, self).keyPressEvent(event)

    # --------------
    # Other builtins
    # --------------
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def eventFilter(self, sender, event):
        if event.type() == QEvent.ChildRemoved:
            self.internalMove.emit()
        elif event.type() == QEvent.KeyPress and (event.key() == Qt.Key_Delete or event.key() == Qt.Key_Backspace):
            item = self.currentRow()
            item_name = self.currentItem().text()
            self.active_element_text = item_name
            self.takeItem(item)
            self.deleteElement.emit()
        return False
项目:RRPam-WDS    作者:asselapathirana    | 项目源码 | 文件源码
def set_text_spinbox(item, value=""):  # useful for qtests.

    for i in range(3):
        QTest.keyPress(item, Qt.Key_Backspace)
        QTest.keyPress(item, Qt.Key_Delete)
    QTest.keyClicks(item, str(value))
    QTest.keyPress(item, Qt.Key_Return)