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


Python QAction.setToolTip方法代码示例

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


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

示例1: addShowActions

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
    def addShowActions(self):
        """Adds a submenu giving access to the (other)
        opened viewer documents"""
        mds = self._actionCollection.viewer_document_select
        docs = mds.viewdocs()
        document_actions = {}
        multi_docs = len(docs) > 1
        if self._panel.widget().currentViewdoc():
            current_doc_filename = self._panel.widget().currentViewdoc().filename()

        m = self._menu
        sm = QMenu(m)
        sm.setTitle(_("Show..."))
        sm.setEnabled(multi_docs)
        ag = QActionGroup(m)
        ag.triggered.connect(self._panel.slotShowViewdoc)

        for d in docs:
            action = QAction(sm)
            action.setText(d.name())
            action._document_filename = d.filename()
            # TODO: Tooltips aren't shown by Qt (it seems)
            action.setToolTip(d.filename())
            action.setCheckable(True)
            action.setChecked(d.filename() == current_doc_filename)

            ag.addAction(action)
            sm.addAction(action)

        m.addSeparator()
        m.addMenu(sm)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:33,代码来源:contextmenu.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
 def __init__ (self, parent):
     super().__init__(parent)
     self.search = SearchWidget(self)
     self.search.searched.connect(self.populatelist)
     
     self.nodelist = QListWidget(self)
     self.nodelist.setSortingEnabled(True)
     self.nodelist.setIconSize(QSize(*(FlGlob.mainwindow.style.boldheight,)*2))
     self.nodelist.currentItemChanged.connect(self.selectnode)
     self.nodelist.itemSelectionChanged.connect(self.onselectionchange)
     self.nodelist.itemActivated.connect(self.activatenode)
     self.nodelist.setSelectionMode(QAbstractItemView.ExtendedSelection)
     
     remwidget = QToolBar(self)
     remselected = QAction("Remove Selected", self)
     remselected.setIcon(QIcon.fromTheme("edit-delete"))
     remselected.setToolTip("Remove selected")
     remselected.triggered.connect(self.remselected)
     self.remselaction = remselected
     remtrash = QAction("Remove Trash", self)
     remtrash.setIcon(QIcon.fromTheme("edit-clear"))
     remtrash.setToolTip("Clear all trash")
     remtrash.triggered.connect(self.remtrash)
     self.remtrashaction = remtrash
     remwidget.addAction(remselected)
     remwidget.addAction(remtrash)
     
     layout = QVBoxLayout(self)
     layout.addWidget(self.search)
     layout.addWidget(self.nodelist)
     layout.addWidget(remwidget)
     self.view = None
     self.active = False
     self.setEnabled(False)
开发者ID:bucaneer,项目名称:flint,代码行数:36,代码来源:nodelistwidget.py

示例3: updateRecentFiles

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
    def updateRecentFiles(self, menu):
        # bootstrap
        actions = menu.actions()
        for i in range(MAX_RECENT_FILES):
            try:
                action = actions[i]
            except IndexError:
                action = QAction(menu)
                menu.addAction(action)
            action.setVisible(False)
            action.triggered.connect(self.openRecentFile)
        # fill
        actions = menu.actions()
        recentFiles = settings.recentFiles()
        count = min(len(recentFiles), MAX_RECENT_FILES)
        for index, recentFile in enumerate(recentFiles[:count]):
            action = actions[index]
            shortName = os.path.basename(recentFile.rstrip(os.sep))

            action.setText(shortName)
            action.setToolTip(recentFile)
            action.setVisible(True)
        for index in range(count, MAX_RECENT_FILES):
            actions[index].setVisible(False)

        menu.setEnabled(len(recentFiles))
开发者ID:yodamaster,项目名称:trufont,代码行数:28,代码来源:application.py

示例4: make_action_helper

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
def make_action_helper(self, text, help_text, shortcut: QShortcut=None,
                       icon_path=None):
    """
    Builds an action.

    Idea from "Rapid GUI Programming with Python and Qt" by Mark Summerfield
        Published:  Jun 2008
        Publisher:  Prentice Hall

    :param text: Short text for description of action.
    :param help_text: Longer description for action.
    :param shortcut: Shortcut key combination for action.
    :param icon_path: Path of icon for action
    :return: built action as QAction
    """
    if icon_path is not None:
        action = QAction(QIcon(icon_path), text, self)
    else:
        action = QAction(text, self)
    if shortcut:
        action.setShortcut(shortcut)

    action.setToolTip(help_text)
    action.setStatusTip(help_text)
    logging.debug("Action set for " + str(type(self)) + ": " + text + " " + str(shortcut))

    return action
开发者ID:aparaatti,项目名称:definator,代码行数:29,代码来源:qt_helper_functions.py

示例5: create_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
 def create_action(self, text, slot=None, shortcut=None, icon=None,
                   tip=None, checkable=False, signal_name='triggered'):
     action = QAction(text, self)
     if shortcut is not None:
         action.setShortcut(shortcut)
     if tip is not None:
         action.setToolTip(tip)
         action.setStatusTip(tip)
     if slot is not None:
         getattr(action, signal_name).connect(slot)
     if checkable:
         action.setCheckable(True)
     return action
开发者ID:ivanovwaltz,项目名称:wavelet_sound_microscope,代码行数:15,代码来源:muse_explorer.py

示例6: _make_context_menu

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
 def _make_context_menu(self):
     global _TR
     m = QMenu(self)
     act1 = QAction( _TR("EditViewWidget","Mark Scannos","context menu item"), m )
     act1.setCheckable(True)
     act1.setToolTip( _TR("EditViewWidget",
                             "Turn on or off marking of words from the scanno file",
                             "context menu tooltip") )
     act1.toggled.connect(self._act_mark_scannos)
     m.addAction(act1)
     act2 = QAction( _TR("EditViewWidget","Mark Spelling","context menu item"), m )
     act2.setCheckable(True)
     act2.setToolTip( _TR("EditViewWidget",
                             "Turn on or off marking words that fail spellcheck",
                             "context menu tooltip") )
     act2.toggled.connect(self._act_mark_spelling)
     m.addAction(act2)
     act3 = QAction( _TR("EditViewWidget","Scanno File...","context menu item"), m )
     act3.setToolTip( _TR("EditViewWidget",
                             "Choose a file of scanno (common OCR error) words",
                             "context menu tooltip") )
     act3.triggered.connect(self._act_choose_scanno)
     m.addAction(act3)
     act4 = QAction( _TR("EditViewWidget","Dictionary...","context menu item"), m )
     act4.setToolTip( _TR("EditViewWidget",
                             "Choose the primary spelling dictionary for this book",
                             "context menu tooltip") )
     act4.triggered.connect(self._act_choose_dict)
     m.addAction(act4)
     return m
开发者ID:B-Rich,项目名称:PPQT2,代码行数:32,代码来源:editview.py

示例7: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
    def __init__(self, home_url):
        super().__init__()

        # store home url
        self.home_url = home_url

        # create and add tool bar on top (non floatable or movable)
        tool_bar = QToolBar(self)

        # create actions, connect to methods, add to tool bar
        action_home = QAction(self)
        action_home.setIcon(QIcon('icon.home.png'))
        action_home.setToolTip('Home')
        action_home.triggered.connect(self.actionHomeTriggered)
        tool_bar.addAction(action_home)

        action_backward = QAction(self)
        action_backward.setEnabled(False)
        action_backward.setIcon(QIcon('icon.backward.png'))
        action_backward.triggered.connect(self.actionBackwardTriggered)
        tool_bar.addAction(action_backward)
        self.action_backward = action_backward

        action_forward = QAction(self)
        action_forward.setEnabled(False)
        action_forward.setIcon(QIcon('icon.forward.png'))
        action_forward.triggered.connect(self.actionForwardTriggered)
        tool_bar.addAction(action_forward)
        self.action_forward = action_forward

        # create and add web view, connect linkClicked signal with our newPage method
        web_view = QWebView()
        # must set DelegationPolicy to include all links
        web_view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        web_view.linkClicked.connect(self.newPage)
        self.web_view = web_view

        # set Layout
        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(tool_bar)
        layout.addWidget(web_view)

        # Initialize history (initially there is no current page)
        self.history = []
        self.current_page_index = -1

        # Finally set the home page
        self.actionHomeTriggered()
开发者ID:wkoot,项目名称:imperialism-remake,代码行数:51,代码来源:browser.py

示例8: Actions

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
class Actions(actioncollection.ActionCollection):
    name = "midiinputtool"

    def createActions(self, parent=None):
        self.capture_start = QAction(parent)
        self.capture_stop = QAction(parent)

        self.capture_start.setIcon(icons.get("media-record"))
        self.capture_stop.setIcon(icons.get("process-stop"))

    def translateUI(self):
        self.capture_start.setText(_("midi input", "Start capturing"))
        self.capture_start.setToolTip(_("midi input", "Start MIDI capturing"))
        self.capture_stop.setText(_("midi input", "Stop capturing"))
        self.capture_stop.setToolTip(_("midi input", "Stop MIDI capturing"))
开发者ID:wbsoft,项目名称:frescobaldi,代码行数:17,代码来源:tool.py

示例9: Actions

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
class Actions(actioncollection.ActionCollection):
    name = "file_export"
    def createActions(self, parent):
        self.export_musicxml = QAction(parent)
        self.export_audio = QAction(parent)

        self.export_musicxml.setIcon(icons.get("document-export"))
        self.export_audio.setIcon(icons.get("document-export"))

    def translateUI(self):
        self.export_musicxml.setText(_("Export Music&XML..."))
        self.export_musicxml.setToolTip(_("Export current document as MusicXML."))

        self.export_audio.setText(_("Export Audio..."))
        self.export_audio.setToolTip(_("Export to different audio formats."))
开发者ID:brownian,项目名称:frescobaldi,代码行数:17,代码来源:__init__.py

示例10: createAction

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
def createAction(self, text, slot=None, shortcut=None, icon=None,
                 tip=None, checkable=False, signal="triggered"):
    action = QAction(text, self)
    if icon is not None:
        action.setIcon(QtGui.QIcon(":/{}.png".format(icon)))
    if shortcut is not None:
        action.setShortcut(shortcut)
    if tip is not None:
        action.setToolTip(tip)
        action.setStatusTip(tip)
    if slot is not None:
        getattr(action, signal).connect(slot) #old-style: self.connect(action, SIGNAL(signal), slot)
    if checkable:
        action.setCheckable(True)
    return action
开发者ID:phildavies10,项目名称:Pycharm_workspace,代码行数:17,代码来源:uiConnections.py

示例11: createaction

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
 def createaction (self, text, slot=None, shortcuts=None, icon=None,
                  tip=None, checkable=False):
     action = QAction(text, self)
     if icon is not None:
         action.setIcon(QIcon.fromTheme(icon))
     if shortcuts is not None:
         action.setShortcuts(shortcuts)
     if tip is not None:
         action.setToolTip(tip)
         action.setStatusTip(tip)
     if slot is not None:
         action.triggered.connect(slot)
     if checkable:
         action.setCheckable(True)
     return action
开发者ID:bucaneer,项目名称:flint,代码行数:17,代码来源:editorwindow.py

示例12: _create_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
 def _create_action(
         self,
         icon_name: Optional[str],
         title: str,
         slot_function: Callable[[None], None],
         tool_tip: Optional[str]=None)-> QAction:
     """
     QAction factory. All items created belong to the calling instance, i.e. created QAction parent is self.
     """
     action = QAction(title, self)
     if icon_name:
         action.setIcon(QIcon.fromTheme(icon_name))
     action.triggered.connect(slot_function)
     if tool_tip:
         action.setToolTip(tool_tip)
     return action
开发者ID:autokey,项目名称:autokey,代码行数:18,代码来源:notifier.py

示例13: create_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
    def create_action(self, text, slot=None, shortcut=None,
                      icon=None, tip=None, checkable=False,
                      signal="triggered()"):
        action = QAction(text, self)
        if icon is not None:
            action.setIcon(QIcon(":/%s.png" % icon))
        if shortcut is not None:
            action.setShortcut(shortcut)
        if tip is not None:
            action.setToolTip(tip)
            action.setStatusTip(tip)
#        if slot is not None:
#            action.connect(slot)
##            self.connect(action, SIGNAL(signal), slot)
        if checkable:
            action.setCheckable(True)
        return action
开发者ID:rzzzwilson,项目名称:pyqt5,代码行数:19,代码来源:tetrisgame.py

示例14: create_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
def create_action(parent, text, shortcut=None, icon=None, tip=None,
                  triggered=None, toggled=None, context=Qt.WindowShortcut):
    """Create a QAction with the given attributes."""
    action = QAction(text, parent)
    if triggered is not None:
        action.triggered.connect(triggered)
    if toggled is not None:
        action.toggled.connect(toggled)
        action.setCheckable(True)
    if icon is not None:
        action.setIcon( icon )
    if shortcut is not None:
        action.setShortcut(shortcut)
    if tip is not None:
        action.setToolTip(tip)
        action.setStatusTip(tip)
    action.setShortcutContext(context)
    return action
开发者ID:Ilias95,项目名称:FF-Multi-Converter,代码行数:20,代码来源:utils.py

示例15: create_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setToolTip [as 别名]
 def create_action(self, text=None, slot=None, tip=None, shortcut=None):
     """
     This create actions for the File menu, things like
     Read Corpus, Rerun Corpus etc
     """
     action = QAction(text, self)
     if shortcut:
         action.setShortcut(shortcut)
     if tip:
         action.setToolTip(tip)
         action.setStatusTip(tip)
     if slot:
         # noinspection PyUnresolvedReferences
         action.triggered.connect(slot)
     if shortcut:
         # noinspection PyUnresolvedReferences
         QShortcut(QKeySequence(shortcut), self).activated.connect(slot)
     return action
开发者ID:linguistica-uchicago,项目名称:lxa5,代码行数:20,代码来源:main_window.py


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