Exemplo n.º 1
0
    def __init__(self, parent=None):
        super(XDockToolbar, self).__init__(parent)

        # defines the position for this widget
        self._currentAction = -1
        self._selectedAction = None
        self._padding = 8
        self._position = XDockToolbar.Position.South
        self._minimumPixmapSize = QSize(16, 16)
        self._maximumPixmapSize = QSize(48, 48)
        self._hoverTimer = QTimer()
        self._hoverTimer.setSingleShot(True)
        self._hoverTimer.setInterval(1000)
        self._actionHeld = False
        self._easingCurve = QEasingCurve(QEasingCurve.InOutQuad)
        self._duration = 200
        self._animating = False

        # install an event filter to update the location for this toolbar
        layout = QBoxLayout(QBoxLayout.LeftToRight)
        layout.setContentsMargins(2, 2, 2, 2)
        layout.setSpacing(0)
        layout.addStretch(1)
        layout.addStretch(1)

        self.setLayout(layout)
        self.setContentsMargins(2, 2, 2, 2)
        self.setMouseTracking(True)
        parent.window().installEventFilter(self)
        parent.window().statusBar().installEventFilter(self)

        self._hoverTimer.timeout.connect(self.emitActionHovered)
Exemplo n.º 2
0
 def __init__( self, orientation, parent ):
     super(XSplitterHandle, self).__init__( orientation, parent )
     
     # create a layout for the different buttons
     self._collapsed      = False
     self._storedSizes    = None
     
     self._collapseBefore = QToolButton(self)
     self._resizeGrip     = QLabel(self)
     self._collapseAfter  = QToolButton(self)
     
     self._collapseBefore.setAutoRaise(True)
     self._collapseAfter.setAutoRaise(True)
     
     self._collapseBefore.setCursor(Qt.ArrowCursor)
     self._collapseAfter.setCursor(Qt.ArrowCursor)
     
     # define the layout
     layout = QBoxLayout(QBoxLayout.LeftToRight, self)
     layout.setContentsMargins(0, 0, 0, 0)
     layout.addStretch(1)
     layout.addWidget(self._collapseBefore)
     layout.addWidget(self._resizeGrip)
     layout.addWidget(self._collapseAfter)
     layout.addStretch(1)
     self.setLayout(layout)
     
     # set the orientation to start with
     self.setOrientation(orientation)
     
     # create connections
     self._collapseAfter.clicked.connect(  self.toggleCollapseAfter )
     self._collapseBefore.clicked.connect( self.toggleCollapseBefore )
Exemplo n.º 3
0
 def __init__(self, parent=None):
     super(XDockToolbar, self).__init__(parent)
     
     # defines the position for this widget
     self._currentAction = -1
     self._selectedAction = None
     self._padding = 8
     self._position = XDockToolbar.Position.South
     self._minimumPixmapSize = QSize(16, 16)
     self._maximumPixmapSize = QSize(48, 48)
     self._hoverTimer = QTimer()
     self._hoverTimer.setSingleShot(True)
     self._hoverTimer.setInterval(1000)
     self._actionHeld = False
     self._easingCurve = QEasingCurve(QEasingCurve.InOutQuad)
     self._duration = 200
     self._animating = False
     
     # install an event filter to update the location for this toolbar
     layout = QBoxLayout(QBoxLayout.LeftToRight)
     layout.setContentsMargins(2, 2, 2, 2)
     layout.setSpacing(0)
     layout.addStretch(1)
     layout.addStretch(1)
     
     self.setLayout(layout)
     self.setContentsMargins(2, 2, 2, 2)
     self.setMouseTracking(True)
     parent.window().installEventFilter(self)
     parent.window().statusBar().installEventFilter(self)
     
     self._hoverTimer.timeout.connect(self.emitActionHovered)