我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用PyQt5.QtCore.Qt.Key_P()。
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]
def setup_menu(self): menu_bar = self.menuBar() file_menu = menu_bar.addMenu('??') open_local_action = QAction('????…', self) open_local_action.setShortcut(QKeySequence.Open) open_local_action.triggered.connect(self.open_local) file_menu.addAction(open_local_action) # search_image_action = QAction('????…', self) # search_image_action.setShortcut(QKeySequence.Find) # search_image_action.triggered.connect(self.search_remote_image) # file_menu.addAction(search_image_action) save_action = QAction('??…', self) save_action.setShortcut(QKeySequence.Save) save_action.triggered.connect(self.save) file_menu.addAction(save_action) # --------------------------------------- function_menu = menu_bar.addMenu('??') preview_action = QAction('??', self) preview_action.setShortcut(Qt.CTRL + Qt.Key_P) preview_action.triggered.connect(self.preview) function_menu.addAction(preview_action)