當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QKeySequence方法代碼示例

本文整理匯總了Python中PySide2.QtGui.QKeySequence方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QKeySequence方法的具體用法?Python QtGui.QKeySequence怎麽用?Python QtGui.QKeySequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PySide2.QtGui的用法示例。


在下文中一共展示了QtGui.QKeySequence方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def __init__(self, widget):
		QMainWindow.__init__(self)
		#self.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
		self.setWindowTitle("TileGAN")
		app_icon = QtGui.QIcon()
		app_icon.addFile(iconFolder + '/icon_tilegan_16x16.png', QtCore.QSize(16, 16))
		app_icon.addFile(iconFolder + '/icon_tilegan_24x24.png', QtCore.QSize(24, 24))
		app_icon.addFile(iconFolder + '/icon_tilegan_32x32.png', QtCore.QSize(32, 32))
		app_icon.addFile(iconFolder + '/icon_tilegan_48x48.png', QtCore.QSize(48, 48))
		app_icon.addFile(iconFolder + '/icon_tilegan_64x64.png', QtCore.QSize(64, 64))
		self.setWindowIcon(app_icon)

		## Exit Action
		exit_action = QAction("Exit", self)
		exit_action.setShortcut(QtGui.QKeySequence("Ctrl+Q"))#)
		exit_action.triggered.connect(self.exit_app)

		# Window dimensions
		self.setCentralWidget(widget)

		geometry = app.desktop().availableGeometry(self)
		self.resize(int(geometry.height() * 0.85), int(geometry.height() * 0.75)) 
開發者ID:afruehstueck,項目名稱:tileGAN,代碼行數:24,代碼來源:tileGAN_client.py

示例2: addShortcut

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def addShortcut(self, shortcut, slotMethod, *args):
        """Add a shortcut to a slot (event handler)

        Args:
            shortcut (STRING): Something like 'ALT+m'
            slotMethod (STRING): Method of GuiSlots 'Slot' class

        Returns:
            object: QShortcut object
        """
        
        # guislot converts to:
        # self.parent.slots.slotMethod()
        guislot = getattr(self.parent.slots, slotMethod)
        
        sc = QtWidgets.QShortcut(QtGui.QKeySequence(shortcut), self.parent)
        
        # connect shortcut to self.parent.slots(*args)
        sc.activated.connect(lambda: guislot(*args))

        return 
開發者ID:chiefenne,項目名稱:PyAero,代碼行數:23,代碼來源:ShortCuts.py

示例3: qui_menu

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def qui_menu(self, action_list_str, menu_str):
        # qui menu creation
        # syntax: self.qui_menu('right_menu_createFolder_atn;Create Folder,Ctrl+D | right_menu_openFolder_atn;Open Folder', 'right_menu')
        if menu_str not in self.uiList.keys():
            self.uiList[menu_str] = QtWidgets.QMenu()
        create_opt_list = [ x.strip() for x in action_list_str.split('|') ]
        for each_creation in create_opt_list:
            ui_info = [ x.strip() for x in each_creation.split(';') ]
            atn_name = ui_info[0]
            atn_title = ''
            atn_hotkey = ''
            if len(ui_info) > 1:
                options = ui_info[1].split(',')
                atn_title = '' if len(options) < 1 else options[0]
                atn_hotkey = '' if len(options) < 2 else options[1]
            if atn_name != '':
                if atn_name == '_':
                    self.uiList[menu_str].addSeparator()
                else:
                    if atn_name not in self.uiList.keys():
                        self.uiList[atn_name] = QtWidgets.QAction(atn_title, self)
                        if atn_hotkey != '':
                            self.uiList[atn_name].setShortcut(QtGui.QKeySequence(atn_hotkey))
                    self.uiList[menu_str].addAction(self.uiList[atn_name]) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:26,代碼來源:universal_tool_template_1116.py

示例4: setupMenu

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def setupMenu(self):
        self.quickMenu(['file_menu;&File','setting_menu;&Setting','help_menu;&Help'])
        cur_menu = self.uiList['setting_menu']
        self.quickMenuAction('setParaA_atn','Set Parameter &A','A example of tip notice.','setParaA.png', cur_menu)
        self.uiList['setParaA_atn'].setShortcut(QtGui.QKeySequence("Ctrl+R"))
        cur_menu.addSeparator()
        # for file menu
        cur_menu = self.uiList['file_menu']
        self.quickMenuAction('newLang_atn','&Add New Language','Add a new translation.','newLang.png', cur_menu)
        self.quickMenuAction('resetLang_atn','&Reset Languages','Reset All.','resetLang.png', cur_menu)
        # for info review
        cur_menu = self.uiList['help_menu']
        self.quickMenuAction('helpHostMode_atnNone','Host Mode - {}'.format(hostMode),'Host Running.','', cur_menu)
        self.quickMenuAction('helpPyMode_atnNone','Python Mode - {}'.format(pyMode),'Python Library Running.','', cur_menu)
        self.quickMenuAction('helpQtMode_atnNone','Qt Mode - {}'.format(qtModeList[qtMode]),'Qt Library Running.','', cur_menu)
        self.quickMenuAction('helpTemplate_atnNone','Universal Tool Teamplate - {}'.format(tpl_ver),'based on Univeral Tool Template v{} by Shining Ying - https://github.com/shiningdesign/universal_tool_template.py'.format(tpl_ver),'', cur_menu)
        cur_menu.addSeparator()
        self.uiList['helpGuide_msg'] = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
        self.quickMenuAction('helpGuide_atnMsg','Usage Guide','How to Usge Guide.','helpGuide.png', cur_menu) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:21,代碼來源:UITranslator.py

示例5: setupMenu

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def setupMenu(self):
        self.quickMenu(['file_menu;&File','setting_menu;&Setting','help_menu;&Help'])
        cur_menu = self.uiList['setting_menu']
        self.quickMenuAction('setParaA_atn','Set Parameter &A','A example of tip notice.','setParaA.png', cur_menu)
        self.uiList['setParaA_atn'].setShortcut(QtGui.QKeySequence("Ctrl+R"))
        cur_menu.addSeparator()
        if 'help_menu' in self.uiList.keys():
            # for info review
            cur_menu = self.uiList['help_menu']
            self.quickMenuAction('helpHostMode_atnNone','Host Mode - {}'.format(hostMode),'Host Running.','', cur_menu)
            self.quickMenuAction('helpPyMode_atnNone','Python Mode - {}'.format(pyMode),'Python Library Running.','', cur_menu)
            self.quickMenuAction('helpQtMode_atnNone','Qt Mode - {}'.format(qtModeList[qtMode]),'Qt Library Running.','', cur_menu)
            self.quickMenuAction('helpTemplate_atnNone','Universal Tool Teamplate - {}'.format(tpl_ver),'based on Univeral Tool Template v{0} by Shining Ying - https://github.com/shiningdesign/universal{1}tool{1}template.py'.format(tpl_ver,'_'),'', cur_menu)
            cur_menu.addSeparator()
            self.uiList['helpGuide_msg'] = self.help
            self.quickMenuAction('helpGuide_atnMsg','Usage Guide','How to Usge Guide.','helpGuide.png', cur_menu) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:18,代碼來源:universal_tool_template_0803.py

示例6: qui_menu

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def qui_menu(self, action_list_str, menu_str):
        # qui menu creation
        # syntax: self.qui_menu('right_menu_createFolder_atn;Create Folder,Ctrl+D | right_menu_openFolder_atn;Open Folder', 'right_menu')
        if menu_str not in self.uiList.keys():
            self.uiList[menu_str] = QtWidgets.QMenu()
        create_opt_list = [ x.strip() for x in action_list_str.split('|') ]
        for each_creation in create_opt_list:
            ui_info = [ x.strip() for x in each_creation.split(';') ]
            atn_name = ui_info[0]
            atn_title = ''
            atn_hotkey = ''
            if len(ui_info) > 1:
                options = ui_info[1].split(',')
                atn_title = '' if len(options) < 1 else options[0]
                atn_hotkey = '' if len(options) < 2 else options[1]
            if atn_name != '':
                if atn_name not in self.uiList.keys():
                    self.uiList[atn_name] = QtWidgets.QAction(atn_title, self)
                    if atn_hotkey != '':
                        self.uiList[atn_name].setShortcut(QtGui.QKeySequence(atn_hotkey))
                self.uiList[menu_str].addAction(self.uiList[atn_name]) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:23,代碼來源:universal_tool_template_1010.py

示例7: _init_shortcuts

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def _init_shortcuts(self):
        """
        Initialize shortcuts

        :return:    None
        """

        center_dockable_views = self.workspace.view_manager.get_center_views()
        for i in range(1, len(center_dockable_views)+1):
            QShortcut(QKeySequence('Ctrl+'+str(i)), self, center_dockable_views[i-1].raise_)

        # Raise the DisassemblyView after everything has initialized
        center_dockable_views[0].raise_()

    #
    # Plugins
    # 
開發者ID:angr,項目名稱:angr-management,代碼行數:19,代碼來源:main_window.py

示例8: set_shortcut

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def set_shortcut(keysequence, parent, method):
    shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(keysequence), parent)
    shortcut.activated.connect(method) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:5,代碼來源:qtutils.py

示例9: keyPressEvent

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def keyPressEvent(self, event):
        self.setText(QtGui.QKeySequence(event.key()).toString().lower())
        self.textEdited.emit(self.text()) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:5,代碼來源:widgets.py

示例10: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def __init__(self, options: Dict[str, object], parent: QWidget = None, maxTabCount = 250):
        super().__init__(parent)
        self.maxTabCount = maxTabCount
        self.setTabsClosable(True)
        self.tabCloseRequested.connect(self.onTabCloseRequest)
        self.log = logging.getLogger(LOGGER_NAMES.PLAYER)
        self.options = options
        self.closeTabShortcut = QShortcut(QKeySequence("Ctrl+W"), self, self.onCtrlW) 
開發者ID:GoSecure,項目名稱:pyrdp,代碼行數:10,代碼來源:BaseWindow.py

示例11: qui_atn

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None):
        self.uiList[ui_name] = QtWidgets.QAction(title, self)
        if icon!=None:
            self.uiList[ui_name].setIcon(QtGui.QIcon(icon))
        if tip !=None:
            self.uiList[ui_name].setStatusTip(tip)
        if key != None:
            self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key))
        if parent !=None:
            if isinstance(parent, (str, unicode)) and parent in self.uiList.keys():
                self.uiList[parent].addAction(self.uiList[ui_name])
            elif isinstance(parent, QtWidgets.QMenu):
                parent.addAction(self.uiList[ui_name])
        return ui_name 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:16,代碼來源:universal_tool_template_1116.py

示例12: qui_key

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def qui_key(self, key_name, key_combo, func):
        self.hotkey[key_name] = QtWidgets.QShortcut(QtGui.QKeySequence(key_combo), self)
        self.hotkey[key_name].activated.connect( func ) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:5,代碼來源:universal_tool_template_1116.py

示例13: Establish_Connections

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def Establish_Connections(self):
        super(self.__class__,self).Establish_Connections()
        # custom ui response
        # shortcut connection
        self.hotkey = {}
        # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self)
        # self.hotkey['my_key'].activated.connect(self.my_key_func)
    # ---- user response list ---- 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:10,代碼來源:universal_tool_template_1116.py

示例14: setupMenu

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def setupMenu(self):
        self.quickMenu('file_menu;&File | setting_menu;&Setting | help_menu;&Help')
        cur_menu = self.uiList['setting_menu']
        for info in ['export', 'import','user']:
            title = info.title()
            self.quickMenuAction('{0}Config_atn'.format(info),'{0} Config (&{1})'.format(title,title[0]),'{0} Setting and Configuration.'.format(title),'{0}Config.png'.format(info), cur_menu)
            self.uiList['{0}Config_atn'.format(info)].setShortcut(QtGui.QKeySequence("Ctrl+{0}".format(title[0])))
        cur_menu.addSeparator()
        super(self.__class__,self).setupMenu() 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:11,代碼來源:universal_tool_template_1020.py

示例15: Establish_Connections

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QKeySequence [as 別名]
def Establish_Connections(self):
        super(self.__class__,self).Establish_Connections()
        # custom ui response
        # shortcut connection
        self.hotkey = {}
        # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self)
        # self.hotkey['my_key'].activated.connect(self.my_key_func) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:9,代碼來源:universal_tool_template_2010.py


注:本文中的PySide2.QtGui.QKeySequence方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。