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

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

项目: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()
项目:SiebenApp    作者:ahitrin    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        key_handlers = {
            Qt.Key_1: self.select_number(1),
            Qt.Key_2: self.select_number(2),
            Qt.Key_3: self.select_number(3),
            Qt.Key_4: self.select_number(4),
            Qt.Key_5: self.select_number(5),
            Qt.Key_6: self.select_number(6),
            Qt.Key_7: self.select_number(7),
            Qt.Key_8: self.select_number(8),
            Qt.Key_9: self.select_number(9),
            Qt.Key_0: self.select_number(0),
            Qt.Key_A: self.start_edit(self.goals.add, 'Add new goal'),
            Qt.Key_C: self.with_refresh(self.goals.toggle_close),
            Qt.Key_D: self.with_refresh(self.goals.delete),
            Qt.Key_I: self.start_edit(self.goals.insert, 'Insert new goal'),
            Qt.Key_L: self.with_refresh(self.goals.toggle_link),
            Qt.Key_Q: self.quit_app.emit,
            Qt.Key_R: self.start_edit(self.goals.rename, 'Rename goal'),
            Qt.Key_S: self.with_refresh(self.goals.swap_goals),
            Qt.Key_V: self.toggle_view,
            Qt.Key_Z: self.toggle_zoom,
            Qt.Key_Escape: self.cancel_edit,
            Qt.Key_Space: self.with_refresh(self.goals.hold_select),
        }
        if event.key() in key_handlers:
            key_handlers[event.key()]()
        else:
            super().keyPressEvent(event)
项目: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]
项目:server    作者:happypandax    | 项目源码 | 文件源码
def create_ui(self):
        w = QWidget(self)
        settings_group = QGroupBox(t("", default="Configuration"), w)
        settings_group_l = QVBoxLayout(settings_group)
        settings = SettingsTabs()
        settings_group_l.addWidget(settings)

        buttons = QGroupBox(w)
        self.server_btn = QPushButton(self.start_ico, t("", default="Start server"))
        self.server_btn.clicked.connect(self.toggle_server)
        self.server_btn.setShortcut(Qt.CTRL | Qt.Key_S)

        #self.webclient_btn = QPushButton(self.start_ico, t("", default="Start webclient"))
        # self.webclient_btn.clicked.connect(self.toggle_client)
        # self.webclient_btn.setShortcut(Qt.CTRL|Qt.Key_W)

        open_config_btn = QPushButton(qta.icon("fa.cogs"), t("", default="Open configuration"))
        open_config_btn.clicked.connect(self.open_cfg)
        open_config_btn.setShortcut(Qt.CTRL | Qt.Key_C)

        convert_btn = QPushButton(qta.icon("fa.refresh"), t("", default="HP to HPX"))
        convert_btn.clicked.connect(self.convert_hp)

        for b in (self.server_btn, open_config_btn, convert_btn):
            b.setFixedHeight(40)
        button_layout = QHBoxLayout(buttons)
        button_layout.addWidget(self.server_btn)
        # button_layout.addWidget(self.webclient_btn)
        button_layout.addWidget(open_config_btn)
        button_layout.addWidget(convert_btn)

        infos = QGroupBox(t("", default="Info"))
        info_layout = QHBoxLayout(infos)
        version_layout = QFormLayout()
        version_layout.addRow(t("", default="Server version") +
                              ':', QLabel(".".join(str(x) for x in constants.version)))
        version_layout.addRow(t("", default="Webclient version") +
                              ':', QLabel(".".join(str(x) for x in constants.version_web)))
        version_layout.addRow(t("", default="Database version") +
                              ':', QLabel(".".join(str(x) for x in constants.version_db)))

        connect_layout = QFormLayout()
        connect_layout.addRow(t("", default="Server") + '@', QLabel(config.host.value + ':' + str(config.port.value)))
        connect_layout.addRow(t("", default="Webclient") + '@',
                              QLabel(config.host_web.value + ':' + str(config.port_web.value)))
        info_layout.addLayout(connect_layout)
        info_layout.addLayout(version_layout)

        main_layout = QVBoxLayout(w)
        main_layout.addWidget(settings_group)
        main_layout.addWidget(infos)
        main_layout.addWidget(buttons)
        self.setCentralWidget(w)

        self.tray.setIcon(QIcon(os.path.join(constants.dir_static, "favicon.ico")))
        self.tray.activated.connect(self.tray_activated)
        tray_menu = QMenu()
        tray_menu.addAction(t("", default="Show"), lambda: self.show())
        tray_menu.addSeparator()
        tray_menu.addAction(t("", default="Quit"), lambda: self.real_close())
        self.tray.setContextMenu(tray_menu)