Draws the foreground for the chart scene.
        
        :param      painter | <QPainter>
                    rect    | <QRect>
510822
def drawForeground(self, painter, rect):
        
        chart = self.chart()
        chart._drawForeground(self, painter, rect)
617305
def foreground_chart(chart, background, colors):
    
    def convert_foreground(entry):
        try:
            attr = urwid.AttrSpec(entry, background, colors)
        except urwid.AttrSpecError:
            return None
        return attr, entry
    return parse_chart(chart, convert_foreground)
1019840
def paintEvent(self, event):
        
        if self.isHoverable() and self.icon().isNull():
            return

        # initialize the painter
        painter = QtGui.QStylePainter()
        painter.begin(self)
        try:
            option = QtGui.QStyleOptionToolButton()
            self.initStyleOption(option)

            # generate the scaling and rotating factors
            x_scale = 1
            y_scale = 1

            if self.flipHorizontal():
                x_scale = -1
            if self.flipVertical():
                y_scale = -1

            center = self.rect().center()
            painter.translate(center.x(), center.y())
            painter.rotate(self.angle())
            painter.scale(x_scale, y_scale)
            painter.translate(-center.x(), -center.y())

            painter.drawComplexControl(QtGui.QStyle.CC_ToolButton, option)
        finally:
            painter.end()
35918
def drawBackground( self, painter, opt, rect, brush ):
        
        if not brush:
            return
        
        painter.setPen(QtCore.Qt.NoPen)
        painter.setBrush(brush)
        painter.drawRect(rect)
501611
def drawBackground(self, painter, rect):
        
        chart = self.chart()
        chart._drawBackground(self, painter, rect)
339717
def paintEvent(self, event):
        """"""
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        # Decoration
        painter.fillPath(self.path_current, QBrush(self.color))
        painter.strokePath(self.path_decoration, QPen(self.color_decoration,
                                                      self.stroke_decoration))
288390
def draw_rect(opts = {})
      x = opts[:top_left][0]
      y = opts[:top_left][1]
      width = opts[:width]
      height = opts[:height]
      color = opts[:color]

      `#{@canvas.context}.fillStyle = #{color}`
      `#{@canvas.context}.fillRect(#{x}, #{y}, #{width}, #{height})`
    end
1042671
def set_palette(self, background, foreground):
        
        palette = QPalette()
        palette.setColor(QPalette.Base, background)
        palette.setColor(QPalette.Text, foreground)
        self.setPalette(palette)

        # Set the right background color when changing color schemes
        # or creating new Editor windows. This seems to be a Qt bug.
        # Fixes Issue 2028 and 8069
        if self.objectName():
            style = "QPlainTextEdit#%s {background: %s; color: %s;}" % \
                    (self.objectName(), background.name(), foreground.name())
            self.setStyleSheet(style)
1311532
def paintEvent(self, event):
        
        if self.isVisible():
            # fill background
            self._background_brush = QtGui.QBrush(self.editor.background)
            painter = QtGui.QPainter(self)
            painter.fillRect(event.rect(), self._background_brush)
            self._draw_messages(painter)
            self._draw_visible_area(painter)
106825
public JFreeChartRender setBackgroundPaint(Color color) {
        chart.setBackgroundPaint(color);
        getPlot().setBackgroundPaint(color);
        return this;
    }
1185031
def _drawForeground(self, scene, painter, rect):
        
        rect = scene.sceneRect()
        if scene == self.uiChartVIEW.scene():
            self.renderer().drawForeground(painter,
                                           rect,
                                           self.showGrid(),
                                           self.showColumns(),
                                           self.showRows())
379631
def paintEvent(self, event):
        
        painter = QPainter(self)
        painter.fillRect(event.rect(), self.editor.sideareas_color)
        # This is needed to make that the font size of line numbers
        # be the same as the text one when zooming
        # See Issue 2296 and 4811
        font = self.editor.font()
        font_height = self.editor.fontMetrics().height()

        active_block = self.editor.textCursor().block()
        active_line_number = active_block.blockNumber() + 1

        def draw_pixmap(ytop, pixmap):
            if not QT55_VERSION:
                pixmap_height = pixmap.height()
            else:
                # scale pixmap height to device independent pixels
                pixmap_height = pixmap.height() / pixmap.devicePixelRatio()
            painter.drawPixmap(0, ytop + (font_height-pixmap_height) / 2,
                               pixmap)

        for top, line_number, block in self.editor.visible_blocks:
            if self._margin:
                if line_number == active_line_number:
                    font.setWeight(font.Bold)
                    painter.setFont(font)
                    painter.setPen(self.editor.normal_color)
                else:
                    font.setWeight(font.Normal)
                    painter.setFont(font)
                    painter.setPen(self.linenumbers_color)

                painter.drawText(0, top, self.width(),
                                 font_height,
                                 Qt.AlignRight | Qt.AlignBottom,
                                 to_text_string(line_number))

            data = block.userData()
            if self._markers_margin and data:
                if data.code_analysis:
                    for source, code, severity, message in data.code_analysis:
                        error = severity == DiagnosticSeverity.ERROR
                        if error:
                            break
                    if error:
                        draw_pixmap(top, self.error_pixmap)
                    else:
                        draw_pixmap(top, self.warning_pixmap)
                if data.todo:
                    draw_pixmap(top, self.todo_pixmap)
106360
def _draw_rect(self, rect, painter):
        
        c = self._custom_color
        if self._native:
            c = self.get_system_bck_color()
        grad = QtGui.QLinearGradient(rect.topLeft(),
                                     rect.topRight())
        if sys.platform == 'darwin':
            grad.setColorAt(0, c.lighter(100))
            grad.setColorAt(1, c.lighter(110))
            outline = c.darker(110)
        else:
            grad.setColorAt(0, c.lighter(110))
            grad.setColorAt(1, c.lighter(130))
            outline = c.darker(100)
        painter.fillRect(rect, grad)
        painter.setPen(QtGui.QPen(outline))
        painter.drawLine(rect.topLeft() +
                         QtCore.QPointF(1, 0),
                         rect.topRight() -
                         QtCore.QPointF(1, 0))
        painter.drawLine(rect.bottomLeft() +
                         QtCore.QPointF(1, 0),
                         rect.bottomRight() -
                         QtCore.QPointF(1, 0))
        painter.drawLine(rect.topRight() +
                         QtCore.QPointF(0, 1),
                         rect.bottomRight() -
                         QtCore.QPointF(0, 1))
        painter.drawLine(rect.topLeft() +
                         QtCore.QPointF(0, 1),
                         rect.bottomLeft() -
                         QtCore.QPointF(0, 1))
1161720
def _draw_rect(self, rect, painter):
        
        c = self.editor.sideareas_color
        grad = QLinearGradient(rect.topLeft(),
                                     rect.topRight())
        if sys.platform == 'darwin':
            grad.setColorAt(0, c.lighter(100))
            grad.setColorAt(1, c.lighter(110))
            outline = c.darker(110)
        else:
            grad.setColorAt(0, c.lighter(110))
            grad.setColorAt(1, c.lighter(130))
            outline = c.darker(100)
        painter.fillRect(rect, grad)
        painter.setPen(QPen(outline))
        painter.drawLine(rect.topLeft() +
                         QPointF(1, 0),
                         rect.topRight() -
                         QPointF(1, 0))
        painter.drawLine(rect.bottomLeft() +
                         QPointF(1, 0),
                         rect.bottomRight() -
                         QPointF(1, 0))
        painter.drawLine(rect.topRight() +
                         QPointF(0, 1),
                         rect.bottomRight() -
                         QPointF(0, 1))
        painter.drawLine(rect.topLeft() +
                         QPointF(0, 1),
                         rect.bottomLeft() -
                         QPointF(0, 1))
521947
def paintEvent(self, event):
        """"""
        super(AutoParameterTableView, self).paintEvent(event)

        if self.dragline is not None:
            pen = QtGui.QPen(QtCore.Qt.blue)
            painter = QtGui.QPainter(self.viewport())
            painter.setPen(pen)
            painter.drawLine(self.dragline)
587121
def drawAxis( self, painter ):
        
        # draw the axis lines
        pen = QPen(self.axisColor())
        pen.setWidth(4)
        painter.setPen(pen)
        painter.drawLines(self._buildData['axis_lines'])
        
        # draw the notches
        for rect, text in self._buildData['grid_h_notches']:
            painter.drawText(rect, Qt.AlignTop | Qt.AlignRight, text)
        
        for rect, text in self._buildData['grid_v_notches']:
            painter.drawText(rect, Qt.AlignCenter, text)
1045347
def paintEvent(self, event):
        """"""
        selections = self.selectionModel()
        option = self.viewOptions()
        state = option.state

        if self.parentWidget() is not None:
            background = self.parentWidget().palette().color(1)
        else:
            background = option.palette.base()

        foreground = QtGui.QPen(option.palette.color(QtGui.QPalette.WindowText))
        textPen = QtGui.QPen(option.palette.color(QtGui.QPalette.Text))
        highlightedPen = QtGui.QPen(option.palette.color(QtGui.QPalette.HighlightedText))

        painter = QtGui.QPainter(self.viewport())
        painter.setRenderHint(QtGui.QPainter.Antialiasing)

        self._calculateRects()

        viewrect = event.rect()
        painter.fillRect(viewrect, background)
        painter.setPen(foreground)

        fontsz = self.font().pointSize()  

        # draw grid lines
        wid = int(max(viewrect.width(), self._width))
        nlines = int((wid/self.pixelsPerms)/self.gridms)
        y0 = viewrect.y()
        y1 = viewrect.y() + viewrect.height()
        for iline in range(1, nlines + 1):
            x = (iline * self.gridms * self.pixelsPerms) - self.horizontalScrollBar().value()
            painter.drawLine(x, y0+fontsz+2, x, y1)
            painter.drawText(x-5, y0+fontsz+1, str(iline*self.gridms))

        # painting of components
        for row in range(self.model().rowCount(self.rootIndex())):
            for col in range(self.model().columnCountForRow(row)):
                index = self.model().index(row, col, self.rootIndex())
                component = self.model().data(index, QtCore.Qt.UserRole)
                if component is not None:
                    option = self.viewOptions()
                    option.rect = self.visualRectRC(row, col)
                    self.itemDelegate().paint(painter, option, index)

        # highlight selected components
        region = self.visualRegionForSelection(self.selectionModel().selection())

        painter.save()
        painter.setClipRegion(region)
        painter.setOpacity(0.5)
        painter.fillRect(viewrect, QtCore.Qt.blue)
        painter.restore()

        if self.dragline is not None:
            pen = QtGui.QPen(QtCore.Qt.blue)
            pen.setWidth(3)
            painter.setPen(pen)
            painter.drawLine(self.dragline)