Exemplo n.º 1
0
def makeMenuToolButton(icon=None, toolTip="", parent=None):
    btn = QtWidgets.QToolButton(parent)
    if icon:
        btn.setIcon(icon)
    btn.setToolTip(toolTip)
    btn.setContentsMargins(0, 0, 0, 0)
    btn.setIconSize(QtCore.QSize(20, 20))
    btn.setPopupMode(btn.InstantPopup)
    menu = QtWidgets.QMenu(btn)
    btn.setMenu(menu)
    return (btn, menu)
Exemplo n.º 2
0
    def _makeRunMoreButton(self):
        _runMoreBtn = QtWidgets.QToolButton(self)
        _runMoreBtn.setIcon(self._view._runPartialIcon)
        _runMoreBtn.setAutoRaise(True)
        _runMoreBtn.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        _runMoreBtn.setPopupMode(_runMoreBtn.InstantPopup)

        self._runSetupAct = QtWidgets.QAction("Run setUp( ) Only", self)
        self._runSetupAct.setIcon(self._view._runPartialIcon)
        self._runSetupAct.triggered.connect(self._runTestSetupOnly)

        self._runNoTearDown = QtWidgets.QAction("Run without tearDown( )",
                                                self)
        self._runNoTearDown.setIcon(self._view._runPartialIcon)
        self._runNoTearDown.triggered.connect(self._runTestWithoutTearDown)

        menu = QtWidgets.QMenu(_runMoreBtn)
        menu.addAction(self._runSetupAct)
        menu.addAction(self._runNoTearDown)
        _runMoreBtn.setMenu(menu)
        return _runMoreBtn