Esempio n. 1
0
 def drawBox(self):
     if self._drawbox:
         self.makeCurrent()
         painter = QPainter(self)
         painter.setPen(self._select_pen)
         painter.drawRect(QRect(*self._drawbox))
         painter.end()
         self.doneCurrent()
Esempio n. 2
0
    def paintEvent(self, event):
        """ A custom paint event for the tab bar.

        This paint event will blit the pixmaps for the alerted tabs as
        necessary, after the superclass paint event handler is run.

        """
        super(QDockTabBar, self).paintEvent(event)
        if self._has_alerts:
            painter = QPainter(self)
            current = self.currentIndex()
            for index, data in enumerate(self._tab_data):
                if data.alerted:
                    rect = self.tabRect(index)
                    pm = data.selected if index == current else data.normal
                    painter.drawPixmap(rect, pm)
    def paintEvent(self, event):
        """ A custom paint event for the tab bar.

        This paint event will blit the pixmaps for the alerted tabs as
        necessary, after the superclass paint event handler is run.

        """
        super(QDockTabBar, self).paintEvent(event)
        if self._has_alerts:
            painter = QPainter(self)
            current = self.currentIndex()
            for index, data in enumerate(self._tab_data):
                if data.alerted:
                    rect = self.tabRect(index)
                    pm = data.selected if index == current else data.normal
                    painter.drawPixmap(rect, pm)
Esempio n. 4
0
    def paintEvent(self, event):
        """ Handle the paint event for the dock rubber band.

        """
        painter = QPainter(self)
        opt = QStyleOption()
        opt.initFrom(self)
        self.style().drawPrimitive(QStyle.PE_Widget, opt, painter, self)
Esempio n. 5
0
    def paintEvent(self, event):
        """ Handle the paint event for the widget.

        """
        super(QIconWidget, self).paintEvent(event)
        icon = self._icon
        if icon.isNull():
            return
        icon.paint(QPainter(self), self.contentsRect())
Esempio n. 6
0
    def paintEvent(self, event):
        """ Handle the paint event for the button.

        """
        painter = QPainter(self)
        opt = self.styleOption()
        self.style().drawPrimitive(QStyle.PE_Widget, opt, painter, self)
        bmp = self._bitmap
        if bmp is not None:
            self.drawBitmap(bmp, opt, painter)
Esempio n. 7
0
    def paintEvent(self, event):
        """ Handle the paint event for the title bar.

        This paint handler draws the title bar text and title buttons.

        """
        super(QTextLabel, self).paintEvent(event)
        rect = self.contentsRect()
        metrics = self.fontMetrics()
        # The +1 is to fix a seeming off-by-one error in elidedText.
        # https://github.com/nucleic/enaml/issues/38
        text = metrics.elidedText(self._text, Qt.ElideRight, rect.width() + 1)
        QPainter(self).drawText(rect, Qt.AlignLeft | Qt.AlignVCenter, text)
Esempio n. 8
0
    def paintEvent(self, event):
        self.proxy.ais_context.UpdateCurrentViewer()
        # important to allow overpainting of the OCC OpenGL context in Qt

        if self._drawbox:
            painter = QPainter(self)
            painter.setPen(self._select_pen)
            painter.drawRect(QRect(*self._drawbox))
Esempio n. 9
0
    def paintEvent(self, event):
        """ Handle the paint event for the rose.

        This handler will redraw all of the guides for the rose.

        """
        super(QGuideRose, self).paintEvent(event)
        painter = QPainter(self)
        Mode = self.Mode
        mode = self._mode
        if mode & Mode.Border:
            self._border_guide.paint(painter)
        if mode & Mode.Compass:
            self._compass_guide.paint(painter)
        elif mode & Mode.CompassEx:
            self._compass_ex_guide.paint(painter)
        elif mode & Mode.SplitHorizontal:
            self._hsplit_guide.paint(painter)
        elif mode & Mode.SplitVertical:
            self._vsplit_guide.paint(painter)
        elif mode & Mode.AreaCenter:
            self._area_guide.paint(painter)