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


Python QAction.setToolTip方法代碼示例

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


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

示例1: create_action

# 需要導入模塊: from qtpy.QtWidgets import QAction [as 別名]
# 或者: from qtpy.QtWidgets.QAction import setToolTip [as 別名]
def create_action(parent, text, shortcut=None, icon=None, tip=None,
                  toggled=None, triggered=None, data=None, menurole=None,
                  context=Qt.WindowShortcut):
    """Create a QAction"""
    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:
        if is_text_string(icon):
            icon = get_icon(icon)
        action.setIcon(icon)
    if shortcut is not None:
        action.setShortcut(shortcut)
    if tip is not None:
        action.setToolTip(tip)
        action.setStatusTip(tip)
    if data is not None:
        action.setData(to_qvariant(data))
    if menurole is not None:
        action.setMenuRole(menurole)
    #TODO: Hard-code all shortcuts and choose context=Qt.WidgetShortcut
    # (this will avoid calling shortcuts from another dockwidget
    #  since the context thing doesn't work quite well with these widgets)
    action.setShortcutContext(context)
    return action
開發者ID:DLlearn,項目名稱:spyder,代碼行數:30,代碼來源:qthelpers.py

示例2: _init_toolbar

# 需要導入模塊: from qtpy.QtWidgets import QAction [as 別名]
# 或者: from qtpy.QtWidgets.QAction import setToolTip [as 別名]
 def _init_toolbar(self):
     a = QAction(getIcon('ruler'), 'Scale bar', self)
     a.setToolTip('Add scale bar')
     a.setCheckable(True)
     a.triggered.connect(self.scalebar)
     self._actions['scalebar'] = a
     self.insertAction(self._actions['configure_subplots'], a)
開發者ID:pyhmsa,項目名稱:pyhmsa-gui,代碼行數:9,代碼來源:toolbar.py

示例3: create_action

# 需要導入模塊: from qtpy.QtWidgets import QAction [as 別名]
# 或者: from qtpy.QtWidgets.QAction import setToolTip [as 別名]
def create_action(parent, text, shortcut=None, icon=None, tip=None,
                  toggled=None, triggered=None, data=None, menurole=None,
                  context=Qt.WindowShortcut):
    """Create a QAction"""
    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:
        if is_text_string(icon):
            icon = get_icon(icon)
        action.setIcon(icon)
    if tip is not None:
        action.setToolTip(tip)
        action.setStatusTip(tip)
    if data is not None:
        action.setData(to_qvariant(data))
    if menurole is not None:
        action.setMenuRole(menurole)

    # Workround for Mac because setting context=Qt.WidgetShortcut
    # there doesn't have any effect
    if sys.platform == 'darwin':
        action._shown_shortcut = None
        if context == Qt.WidgetShortcut:
            if shortcut is not None:
                action._shown_shortcut = shortcut
            else:
                # This is going to be filled by
                # main.register_shortcut
                action._shown_shortcut = 'missing'
        else:
            if shortcut is not None:
                action.setShortcut(shortcut)
            action.setShortcutContext(context)
    else:
        if shortcut is not None:
            action.setShortcut(shortcut)
        action.setShortcutContext(context)

    return action
開發者ID:G-VAR,項目名稱:spyder,代碼行數:45,代碼來源:qthelpers.py


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