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


Python QAction.toolTip方法代码示例

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


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

示例1: __init__

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

        self.setMinimumHeight(500)
        self.setMinimumWidth(800)
        self.setWindowTitle('AndORra - конструктор схем')
        self.menubar = self.menuBar()
        self.central_widget = CentralWidget(self.setStatus)

        # init menu
        actionWire = QAction(QIcon('img/wire.png'), 'Wire', self)
        actionWire.setShortcut('w')
        actionWire.setStatusTip('Connect elements')
        actionWire.toolTip = 'WIRE'
        actionWire.triggered.connect(self.central_widget.setElement)

        actionPt = QAction(QIcon('img/point.png'), 'Point', self)
        actionPt.setShortcut('p')
        actionPt.toolTip = 'PT'
        actionPt.triggered.connect(self.central_widget.setElement)

        actionNo = QAction(QIcon('img/no.png'), 'NOT', self)
        actionNo.toolTip = 'NOT'
        actionNo.setShortcut('n')
        actionNo.triggered.connect(self.central_widget.setElement)

        actionOr = QAction(QIcon('img/or.png'), 'OR', self)
        actionOr.toolTip = 'OR'
        actionOr.setShortcut('r')
        actionOr.triggered.connect(self.central_widget.setElement)

        actionAnd = QAction(QIcon('img/and.png'), 'AND', self)
        actionAnd.toolTip = 'AND'
        actionAnd.setShortcut('a')
        actionAnd.triggered.connect(self.central_widget.setElement)

        actionIn = QAction(QIcon('img/in.png'), 'IN', self)
        actionIn.toolTip = 'IN'
        actionIn.setShortcut('i')
        actionIn.triggered.connect(self.central_widget.setElement)

        actionOut = QAction(QIcon('img/out.png'), 'OUT', self)
        actionOut.toolTip = 'OUT'
        actionOut.setShortcut('e')
        actionOut.triggered.connect(self.central_widget.setElement)

        actionCalc = QAction(QIcon('img/point.png'), 'Подсчитать', self)
        actionCalc.setShortcut('ctrl+c')
        actionCalc.triggered.connect(self.central_widget.calc)

        actionSaveScheme = QAction(QIcon('img/point.png'), 'Сохранить в файл', self)
        actionSaveScheme.setShortcut('ctrl+s')
        actionSaveScheme.triggered.connect(self.central_widget.saveFileDialog)

        actionLoadScheme = QAction(QIcon('img/point.png'), 'Загрузить файл', self)
        actionLoadScheme.setShortcut('ctrl+o')
        actionLoadScheme.triggered.connect(self.central_widget.openFileDialog)

        # actionSave = QPushButton('Save')
        # actionSave.setShortcut('ctrl+s')
        # actionSave.triggered.connect(self.saveLogic)

        actionQuit = QAction(QIcon('img/point.png'), 'Выход', self)
        actionQuit.setShortcut('ctrl+q')
        actionQuit.triggered.connect(quit)

        actionClear = QAction(QIcon('img/point.png'), 'Очистить', self)
        actionClear.setShortcut('ctrl+del')
        actionClear.triggered.connect(self.central_widget.clearScheme)

        schemeMenu = self.menubar.addMenu('&Схема')
        schemeMenu.addAction(actionCalc)
        schemeMenu.addAction(actionSaveScheme)
        schemeMenu.addAction(actionLoadScheme)
        schemeMenu.addAction(actionClear)
        schemeMenu.addAction(actionQuit)

        elemMenu = self.menubar.addMenu('&Элементы')
        elemMenu.addAction(actionWire)
        elemMenu.addAction(actionIn)
        elemMenu.addAction(actionOut)
        elemMenu.addAction(actionOr)
        elemMenu.addAction(actionAnd)
        elemMenu.addAction(actionPt)

        optionsMenu = self.menubar.addMenu('&Настройки')

        self.resize(800, 500)
        self.setCentralWidget(self.central_widget)
        self.setStatus('Готов к работе')
开发者ID:VoidArray,项目名称:AndORra,代码行数:92,代码来源:mainwindow.py


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