当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QMenu方法代码示例

本文整理汇总了Python中PySide.QtGui.QMenu方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QMenu方法的具体用法?Python QtGui.QMenu怎么用?Python QtGui.QMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui的用法示例。


在下文中一共展示了QtGui.QMenu方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CustomContextMenuHandler

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def CustomContextMenuHandler(self, pos):
        menu = QtGui.QMenu(self)
        menu.addAction(QtGui.QAction("Xref ...", self,
                statusTip="List the references where this element is used",
                triggered=self.actionXref))
        menu.addAction(QtGui.QAction("Go to...", self,
                statusTip="Go to element definition",
                triggered=self.actionGoto))
        menu.addAction(QtGui.QAction("Rename...", self,
                statusTip="Rename an element (class, method, ...)",
                triggered=self.actionRename))
        menu.addAction(QtGui.QAction("Info...", self,
                statusTip="Display info of an element (anything useful in the document)",
                triggered=self.actionInfo))
        menu.addAction(QtGui.QAction("Reload sources...", self,
                statusTip="Reload sources (needed when renaming changed other tabs)",
                triggered=self.reload_java_sources))
        menu.addAction(QtGui.QAction("Open bytecodes...", self,
                statusTip="",
                triggered=self.display_bytecodes))
        menu.exec_(QtGui.QCursor.pos()) 
开发者ID:DroidTest,项目名称:TimeMachine,代码行数:23,代码来源:sourcewindow.py

示例2: qui_menu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [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

示例3: qui_menubar

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def qui_menubar(self, menu_list_str):
        if not isinstance(self, QtWidgets.QMainWindow):
            print("Warning: Only QMainWindow can have menu bar.")
            return
        menubar = self.menuBar()
        create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
        for each_creation in create_opt_list:
            ui_info = [ x.strip() for x in each_creation.split(';') ]
            menu_name = ui_info[0]
            menu_title = ''
            if len(ui_info) > 1:
                menu_title = ui_info[1]
            if menu_name not in self.uiList.keys():
                self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
            menubar.addMenu(self.uiList[menu_name])
    
    #=======================================
    # ui creation functions
    #======================================= 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:21,代码来源:universal_tool_template_1116.py

示例4: qui_menubar

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def qui_menubar(self, menu_list_str):
        if not isinstance(self, QtWidgets.QMainWindow):
            print("Warning: Only QMainWindow can have menu bar.")
            return
        menubar = self.menuBar()
        create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
        for each_creation in create_opt_list:
            ui_info = [ x.strip() for x in each_creation.split(';') ]
            menu_name = ui_info[0]
            menu_title = ''
            if len(ui_info) > 1:
                menu_title = ui_info[1]
            if menu_name not in self.uiList.keys():
                self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
            menubar.addMenu(self.uiList[menu_name])
    # compatible hold function 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:universal_tool_template_1020.py

示例5: setLang

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def setLang(self, langName):
        uiList_lang_read = self.memoData['lang'][langName]
        for ui_name in uiList_lang_read:
            ui_element = self.uiList[ui_name]
            if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:
                # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                if uiList_lang_read[ui_name] != "":
                    ui_element.setText(uiList_lang_read[ui_name])
            elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:
                # uiType: QMenu, QGroupBox
                if uiList_lang_read[ui_name] != "":
                    ui_element.setTitle(uiList_lang_read[ui_name])
            elif type(ui_element) in [ QtWidgets.QTabWidget]:
                # uiType: QTabWidget
                tabCnt = ui_element.count()
                if uiList_lang_read[ui_name] != "":
                    tabNameList = uiList_lang_read[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != "":
                                ui_element.setTabText(i,tabNameList[i])
            elif type(ui_element) == str:
                # uiType: string for msg
                if uiList_lang_read[ui_name] != "":
                    self.uiList[ui_name] = uiList_lang_read[ui_name] 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:27,代码来源:UITranslator.py

示例6: setLang

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def setLang(self, langName):
        uiList_lang_read = self.memoData['lang'][langName]
        for ui_name in uiList_lang_read:
            ui_element = self.uiList[ui_name]
            if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]:
                # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                if uiList_lang_read[ui_name] != "":
                    ui_element.setText(uiList_lang_read[ui_name])
            elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]:
                # uiType: QMenu, QGroupBox
                if uiList_lang_read[ui_name] != "":
                    ui_element.setTitle(uiList_lang_read[ui_name])
            elif type(ui_element) in [ QtGui.QTabWidget]:
                # uiType: QTabWidget
                tabCnt = ui_element.count()
                if uiList_lang_read[ui_name] != "":
                    tabNameList = uiList_lang_read[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != "":
                                ui_element.setTabText(i,tabNameList[i])
            elif type(ui_element) == str:
                # uiType: string for msg
                if uiList_lang_read[ui_name] != "":
                    self.uiList[ui_name] = uiList_lang_read[ui_name] 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:27,代码来源:UITranslator_v1.0.py

示例7: qui_menu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [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

示例8: contextMenuEvent

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def contextMenuEvent(self, event):
        menu = QtGui.QMenu(self)
        menu.addAction(self.xrefAct)
        menu.addAction(self.expandAct)
        menu.addAction(self.collapseAct)
        menu.exec_(event.globalPos()) 
开发者ID:DroidTest,项目名称:TimeMachine,代码行数:8,代码来源:treewindow.py

示例9: setupFileMenu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def setupFileMenu(self):
        fileMenu = QtGui.QMenu("&File", self)
        self.menuBar().addMenu(fileMenu)

        fileMenu.addAction("&Open...", self.openFile, "Ctrl+O")
        fileMenu.addAction("&Add...", self.addFile, "Ctrl+A")
        fileMenu.addAction("&Save...", self.saveFile, "Ctrl+S")
        fileMenu.addAction("E&xit", self.quit, "Ctrl+Q") 
开发者ID:DroidTest,项目名称:TimeMachine,代码行数:10,代码来源:mainwindow.py

示例10: setupViewMenu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def setupViewMenu(self):
        viewMenu = QtGui.QMenu("&View", self)
        self.menuBar().addMenu(viewMenu)

        viewMenu.addAction("&Strings...", self.openStringsWindow) 
开发者ID:DroidTest,项目名称:TimeMachine,代码行数:7,代码来源:mainwindow.py

示例11: setupHelpMenu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMenu [as 别名]
def setupHelpMenu(self):
        helpMenu = QtGui.QMenu("&Help", self)
        self.menuBar().addMenu(helpMenu)

        helpMenu.addAction("&About", self.about)
        helpMenu.addAction("About &Qt", QtGui.qApp.aboutQt) 
开发者ID:DroidTest,项目名称:TimeMachine,代码行数:8,代码来源:mainwindow.py


注:本文中的PySide.QtGui.QMenu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。