Python源码示例:PyQt5.QtCore.Qt.white()

示例1
def __init__(self):
        QtWidgets.QWidget.__init__(self)
        uic.loadUi("window.ui", self)
        self.scene = Scene(0, 0, 561, 581)
        self.scene.win = self
        self.view.setScene(self.scene)
        self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
        self.image.fill(Qt.white)
        self.bars.clicked.connect(lambda : set_bars(self))
        self.erase.clicked.connect(lambda: clean_all(self))
        self.paint.clicked.connect(lambda: clipping(self))
        self.rect.clicked.connect(lambda: set_rect(self))
        self.ect.clicked.connect(lambda: add_bars(self))
        self.lines = []
        self.clip = None
        self.point_now = None
        self.input_bars = False
        self.input_rect = False
        self.pen = QPen(red) 
示例2
def __init__(self):
        QtWidgets.QWidget.__init__(self)
        uic.loadUi("window.ui", self)
        self.scene = Scene(0, 0, 561, 581)
        self.scene.win = self
        self.view.setScene(self.scene)
        self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
        self.image.fill(Qt.white)
        self.bars.clicked.connect(lambda : set_bars(self))
        self.erase.clicked.connect(lambda: clean_all(self))
        self.paint.clicked.connect(lambda: clipping(self))
        self.rect.clicked.connect(lambda: set_rect(self))
        self.ect.clicked.connect(lambda: add_bars(self))
        self.lock.clicked.connect(lambda: lock(self))
        self.lines = []
        self.edges = []
        self.clip = None
        self.point_now_rect = None
        self.point_now_bars = None
        self.point_lock = None
        self.input_bars = False
        self.input_rect = False
        self.pen = QPen(black) 
示例3
def __init__(self):
        QtWidgets.QWidget.__init__(self)
        uic.loadUi("window.ui", self)
        self.scene = QtWidgets.QGraphicsScene(0, 0, 511, 511)
        self.mainview.setScene(self.scene)
        self.image = QImage(511, 511, QImage.Format_ARGB32_Premultiplied)
        self.pen = QPen()
        self.color_line = QColor(Qt.black)
        self.color_bground = QColor(Qt.white)
        self.draw_once.clicked.connect(lambda: draw_once(self))
        self.clean_all.clicked.connect(lambda: clear_all(self))
        self.btn_bground.clicked.connect(lambda: get_color_bground(self))
        self.btn_line.clicked.connect(lambda: get_color_line(self))
        self.draw_centr.clicked.connect(lambda: draw_centr(self))
        layout = QtWidgets.QHBoxLayout()
        layout.addWidget(self.what)
        layout.addWidget(self.other)
        self.setLayout(layout)
        self.circle.setChecked(True)
        self.canon.setChecked(True)
        #self.circle.toggled.connect(lambda : change_text(self)) 
示例4
def _updateAutoForegroundColForeground(self, row):
        item = self.item(row, self._autoForegroundCol)
        if item is None: return

        try:
            value = float(item.data(self._role))
        except Exception as ex:
            value = 0 # if referenced item doesn't have value or not number, think it as default 0.

        if value > 0:
            color = Qt.red
        elif value < 0:
            color = Qt.darkGreen
        else:
            if item.background() == Qt.white: # for qdarkstyle
                color = Qt.black
            else:
                color = QColor('#C0C0C0')

        item.setForeground(color) 
示例5
def _getForeground(self, rowData, autoForegroundCol, item):

        # 如果@rowData的item个数小于等于@autoForegroundCol
        # 支持row数据比header少的状况
        try:
            value = rowData[autoForegroundCol]

            color = self.getForegroundOverride(value)
        except Exception as ex:
            color = None
        
        if color is None:
            if item.background() == Qt.white:
                color = Qt.black

            else: # for qdarkstyle
                color = QColor(192, 192, 192)
            
        return color 
示例6
def __init__(self):
        super(VideoStyleLight, self).__init__()
        palette = qApp.palette()
        palette.setColor(QPalette.Window, QColor(239, 240, 241))
        palette.setColor(QPalette.WindowText, QColor(49, 54, 59))
        palette.setColor(QPalette.Base, QColor(252, 252, 252))
        palette.setColor(QPalette.AlternateBase, QColor(239, 240, 241))
        palette.setColor(QPalette.ToolTipBase, QColor(239, 240, 241))
        palette.setColor(QPalette.ToolTipText, QColor(49, 54, 59))
        palette.setColor(QPalette.Text, QColor(49, 54, 59))
        palette.setColor(QPalette.Button, QColor(239, 240, 241))
        palette.setColor(QPalette.ButtonText, QColor(49, 54, 59))
        palette.setColor(QPalette.BrightText, QColor(255, 255, 255))
        palette.setColor(QPalette.Link, QColor(41, 128, 185))
        # palette.setColor(QPalette.Highlight, QColor(126, 71, 130))
        # palette.setColor(QPalette.HighlightedText, Qt.white)
        palette.setColor(QPalette.Disabled, QPalette.Light, Qt.white)
        palette.setColor(QPalette.Disabled, QPalette.Shadow, QColor(234, 234, 234))
        qApp.setPalette(palette) 
示例7
def __init__(self):
        super(VideoStyleDark, self).__init__()
        palette = qApp.palette()
        palette.setColor(QPalette.Window, QColor(27, 35, 38))
        palette.setColor(QPalette.WindowText, QColor(234, 234, 234))
        palette.setColor(QPalette.Base, QColor(27, 35, 38))
        palette.setColor(QPalette.AlternateBase, QColor(12, 15, 16))
        palette.setColor(QPalette.ToolTipBase, QColor(27, 35, 38))
        palette.setColor(QPalette.ToolTipText, Qt.white)
        palette.setColor(QPalette.Text, QColor(234, 234, 234))
        palette.setColor(QPalette.Button, QColor(27, 35, 38))
        palette.setColor(QPalette.ButtonText, Qt.white)
        palette.setColor(QPalette.BrightText, QColor(100, 215, 222))
        palette.setColor(QPalette.Link, QColor(126, 71, 130))
        # palette.setColor(QPalette.Highlight, QColor(126, 71, 130))
        # palette.setColor(QPalette.HighlightedText, Qt.white)
        palette.setColor(QPalette.Disabled, QPalette.Light, Qt.black)
        palette.setColor(QPalette.Disabled, QPalette.Shadow, QColor(12, 15, 16))
        qApp.setPalette(palette) 
示例8
def __init__(self, parentChart, color=Qt.white):
        super().__init__()
        self.textColor = color
        self.parentChart = parentChart
        
        self.hovered.connect(self.onHover)
        self.callout = Callout(self.name(), parentChart, self.textColor)

        self.callout.setZValue(100)
        self.clicked.connect(self.onClicked)

        self.labelTimer = QTimer()
        self.labelTimerTimeout = 3000
        self.labelTimer.timeout.connect(self.onLabelTimer)
        self.labelTimer.setSingleShot(True)
        self.timerRunning = False 
示例9
def __init__(self, displayText, parent, textColor=Qt.white):
        # super().__init__(displayText, parent)
        super().__init__(parent=parent)
        self.textColor = textColor
        self.chartParent = parent
        
        # Pen draws the outline, brush does the character fill
        # The doc says the pen is slow so don't use it unless you have to
        # penBorder = QPen(self.textColor)
        # penBorder.setWidth(2)
        # self.setPen(penBorder)

        newBrush = QBrush(self.textColor)
        self.setBrush(newBrush)
        
    # Has setText() and text() methods 
示例10
def createSpectrumLine(self):
        if not self.spectrum24Line:
            # add it
            
            # 2.4 GHz
            self.spectrum24Line = self.createNewSeries(Qt.white, self.chart24)
            self.spectrum24Line.setName('Spectrum')
            
            self.chart24.addSeries(self.spectrum24Line)
            self.spectrum24Line.attachAxis(self.chart24.axisX())
            self.spectrum24Line.attachAxis(self.chart24.axisY())

        if not self.spectrum5Line:
            # 5 GHz
            self.spectrum5Line = self.createNewSeries(Qt.white, self.chart5)
            self.spectrum5Line.setName('Spectrum')
            
            self.chart5.addSeries(self.spectrum5Line)
            self.spectrum5Line.attachAxis(self.chart5.axisX())
            self.spectrum5Line.attachAxis(self.chart5.axisY())
            # self.spectrum5Line.setUseOpenGL(True) # This causes the entire window to go blank 
示例11
def paintEvent(self, event):
        super(ScaleWindow, self).paintEvent(event)
        if self._image:
            painter = QPainter(self)
            painter.setRenderHint(QPainter.Antialiasing, True)
            path = QPainterPath()
            radius = min(self.width(), self.height()) / 2
            path.addRoundedRect(QRectF(self.rect()), radius, radius)
            painter.setClipPath(path)
            # 图片
            painter.drawImage(self.rect(), self._image)
            # 中间蓝色十字线
            painter.setPen(QPen(QColor(0, 174, 255), 3))
            hw = self.width() / 2
            hh = self.height() / 2
            painter.drawLines(
                QLineF(hw, 0, hw, self.height()),
                QLineF(0, hh, self.width(), hh)
            )
            # 边框
            painter.setPen(QPen(Qt.white, 3))
            painter.drawRoundedRect(self.rect(), radius, radius) 
示例12
def paintEvent(self, event):
        ancho, altura = self.width(), self.height()
        icono = self.icono.scaled(ancho, altura, Qt.KeepAspectRatio, Qt.SmoothTransformation)

        pintor = QPainter()
        
        pintor.begin(self)
        pintor.setRenderHint(QPainter.Antialiasing, True)
        pintor.setPen(Qt.NoPen)
        pintor.drawPixmap(0, 0, icono, 0, 0, 0, 0)
        pintor.setPen(Qt.white)
        pintor.drawText(event.rect(), Qt.AlignCenter, self.etiqueta)
        pintor.setPen(Qt.NoPen)
        pintor.setBrush(self.opacidad)
        pintor.drawEllipse(0, 0, ancho, altura)
        pintor.end()

        self.setMask(icono.mask()) 
示例13
def paintEvent(self, event):
        super(Label, self).paintEvent(event)
        # 中正间画十字
        painter = QPainter(self)
        painter.setPen(Qt.red)
        x = int(self.width() / 2)
        y = int(self.height() / 2)
        painter.drawLine(x, 0, x, self.height())
        painter.drawLine(0, y, self.width(), y)
        if self.ismd:
            # 画坐标点
            pos = QCursor.pos()
            ret = win32gui.GetPixel(win32gui.GetWindowDC(
                win32gui.GetDesktopWindow()), pos.x(), pos.y())
            r, g, b = ret & 0xff, (ret >> 8) & 0xff, (ret >> 16) & 0xff
            print(r, g, b)
            painter.setPen(Qt.white)
            painter.drawText(self.rect(), Qt.AlignLeft |
                             Qt.AlignBottom, '({}, {})\nRGB: ({}, {}, {})\n{}'.format(
                                 pos.x(), pos.y(), r, g, b, QColor(r, g, b).name())) 
示例14
def _updateAutoForegroundColForeground(self, row):
        item = self.item(row, self._autoForegroundCol)
        if item is None: return

        try:
            value = float(item.data(self._role))
        except Exception as ex:
            value = 0 # if referenced item doesn't have value or not number, think it as default 0.

        if value > 0:
            color = Qt.red
        elif value < 0:
            color = Qt.darkGreen
        else:
            if item.background() == Qt.white: # for qdarkstyle
                color = Qt.black
            else:
                color = QColor('#C0C0C0')

        item.setForeground(color) 
示例15
def _getForeground(self, rowData, autoForegroundCol, item):

        # 如果@rowData的item个数小于等于@autoForegroundCol
        # 支持row数据比header少的状况
        try:
            value = rowData[autoForegroundCol]

            color = self.getForegroundOverride(value)
        except Exception as ex:
            color = None
        
        if color is None:
            if item.background() == Qt.white:
                color = Qt.black

            else: # for qdarkstyle
                color = QColor(192, 192, 192)
            
        return color 
示例16
def paint_status(self):
        a_offs = 20
        base_x = self.rect_x + self.get_pixel_qty_per_line() * self.pixelSize + a_offs + 10

        lines = []
        lines.append("[Data]")
        lines.append(" Type: %s" % self.formatters[self.cur_formatter_idx][1])
        lines.append(" Mode: %s" % self.composition_modes[self.cur_compos_mode][1])

        cur_line = 1
        text_x_pos = base_x + 10
        self.qp.setPen(QColor(Qt.white))
        for line in lines:
            text_y_pos = self.rect().height() - (self.qp.fontMetrics().height()/2) - (len(lines) - cur_line) * (self.qp.fontMetrics().height())

            # draw status
            self.qp.drawText(text_x_pos,
                text_y_pos,
                line)
            cur_line += 1

    # functions that can be called by filters
    # must no be called from within on_process_buffer() 
示例17
def __init__(self):
        super().__init__()
        self.setColor(QPalette.Window, QColor(56, 56, 56))

        self.setColor(QPalette.WindowText, Qt.white)

        self.setColor(QPalette.Base, QColor(56, 56, 56))

        self.setColor(QPalette.AlternateBase, QColor(63, 63, 63))
        self.setColor(QPalette.ToolTipBase, Qt.white)
        self.setColor(QPalette.ToolTipText, Qt.white)

        self.setColor(QPalette.Text, Qt.white)

        self.setColor(QPalette.Button, QColor(56, 56, 56))

        self.setColor(QPalette.ButtonText, Qt.white)

        self.setColor(QPalette.BrightText, QColor(0, 128, 152))

        self.setColor(QPalette.Link, QColor(42, 130, 218))

        self.setColor(QPalette.Highlight, QColor(0, 128, 152))

        self.setColor(QPalette.HighlightedText, Qt.white)

        self.setColor(QPalette.Disabled, QPalette.Window, QColor(51, 51, 51))

        self.setColor(QPalette.Disabled, QPalette.ButtonText,
                      QColor(111, 111, 111))

        self.setColor(QPalette.Disabled, QPalette.Text, QColor(122, 118, 113))

        self.setColor(QPalette.Disabled, QPalette.WindowText,
                      QColor(122, 118, 113))

        self.setColor(QPalette.Disabled, QPalette.Base, QColor(32, 32, 32)) 
示例18
def __init__(self):
        QtWidgets.QWidget.__init__(self)
        uic.loadUi("window.ui", self)
        self.scene = QtWidgets.QGraphicsScene(0, 0, 511, 511)
        self.mainview.setScene(self.scene)
        self.image = QImage(511, 511, QImage.Format_ARGB32_Premultiplied)
        self.pen = QPen()
        self.color_line = QColor(Qt.black)
        self.color_bground = QColor(Qt.white)
        self.draw_line.clicked.connect(lambda: draw_line(self))
        self.clean_all.clicked.connect(lambda : clear_all(self))
        self.btn_bground.clicked.connect(lambda: get_color_bground(self))
        self.btn_line.clicked.connect(lambda: get_color_line(self))
        self.draw_sun.clicked.connect(lambda: draw_sun(self))
        self.cda.setChecked(True) 
示例19
def get_color_bground(win):
    color = QtWidgets.QColorDialog.getColor(initial=Qt.white, title="Цвет фона",
                                            options=QtWidgets.QColorDialog.DontUseNativeDialog)
    if color.isValid():
        win.color_bground = color
        win.image.fill(color)
        s = QtWidgets.QGraphicsScene(0, 0, 10, 10)
        s.setBackgroundBrush(color)
        win.bground_color.setScene(s)
        win.scene.setBackgroundBrush(color) 
示例20
def clean_all(win):
    win.scene.clear()
    win.table.clear()
    win.lines = []
    win.image.fill(Qt.white)
    r = win.table.rowCount()
    for i in range(r, -1, -1):
        win.table.removeRow(i) 
示例21
def get_color_bground(win):
    color = QtWidgets.QColorDialog.getColor(initial=Qt.white, title="Цвет фона",
                                            options=QtWidgets.QColorDialog.DontUseNativeDialog)
    if color.isValid():
        win.color_bground = color
        win.image.fill(color)
        s = QtWidgets.QGraphicsScene(0, 0, 10, 10)
        s.setBackgroundBrush(color)
        win.bground_color.setScene(s)
        win.scene.setBackgroundBrush(color) 
示例22
def __init__(self, text_color=Qt.white, font=QtGui.QFont.DemiBold):
        super(_StandardTextFormat, self).__init__()
        self.setFontWeight(font)
        self.setForeground(text_color)
        self.setFontPointSize(13)
        self.setVerticalAlignment(QtGui.QTextCharFormat.AlignMiddle)


# TODO: see `QTextEdit.setAlignment` for setting the time to the right 
示例23
def initialize(self):
        self.background_color = QColor(self.secondary_color) if self.secondary_color else QColor(Qt.white)
        self.eraser_color = QColor(self.secondary_color) if self.secondary_color else QColor(Qt.white)
        self.eraser_color.setAlpha(100)
        self.reset() 
示例24
def _setAutoRowForeground(self, item):
        if self._autoForegroundCol is None:
            return

        # ignore 'Org.' column
        if self.__index and item.column() == 0:
            return

        # get forground of reference item
        row = item.row()

        refItem = self.item(row, self._autoForegroundCol)

        if not refItem:
            return

        # set forground same as reference item
        item.setForeground(refItem.foreground())

        # we still need to go through row if value of reference item changed
        if item.column() == self._autoForegroundCol:
            # get foreground for row
            color = self.getForegroundOverride(item.data(self._role))
            if color is None:
                if item.background() == Qt.white: # for qdarkstyle
                    color = Qt.black
                else:
                    color = Qt.white

            # no foreground changed
            if item.foreground() == color:
                return

            for i in range(self.columnCount()):
                if self.__index and i == 0: continue

                item = self.item(row, i)
                if item:
                    item.setForeground(color) 
示例25
def setRoundMask(self):
        bmp = QPixmap(self.size())
        bmp.fill(Qt.white)
        p = QPainter(bmp)
        p.setRenderHint(QPainter.Antialiasing)
        p.setBrush(QBrush(Qt.white))
        p.setCompositionMode(QPainter.CompositionMode_Clear)
        p.drawRoundedRect(0, 0, self.width(), self.height(), 3, 3)
        p.end()
        self.setMask(QRegion(QBitmap(bmp))) 
示例26
def draw(self, defending, status, scene, size):
        """function draw

        :param defending: bool
        :param status: str {'Charge', 'Shoot', 'Stand'}
        :param scene: QGraphicsScene
        :param size: QSize

        no return
        """
        if not isinstance(defending, bool):
            raise ValueError('defending must be a boolean')
        if not isinstance(status, str) or (status != 'Charge' and status != 'Shoot' and status != 'Stand'):
            raise ValueError('status must be a str in {\'Charge\', \'Shoot\', \'Stand\'}')

        self.unitType.draw(defending, status, scene, size)
        flag_width = self.nation.flag.width() * 10 / self.nation.flag.height()
        item = scene.addPixmap(self.nation.flag.scaled(flag_width, 10))
        item.setPos(size.width() - 5 - flag_width, 0)
        # life bar
        item1 = QGraphicsRectItem(0, size.height() - 10, size.width() - 5, 5)
        item1.setBrush(QBrush(Qt.white))
        item2 = QGraphicsRectItem(0, size.height() - 10, self.unitStrength / 100 * (size.width() - 5), 5)
        item2.setBrush(QBrush(Qt.green))
        # moral bar
        item3 = QGraphicsRectItem(0, size.height() - 15, size.width() - 5, 5)
        item3.setBrush(QBrush(Qt.white))
        item4 = QGraphicsRectItem(0, size.height() - 15, self.moral / 100 * (size.width() - 5), 5)
        item4.setBrush(QBrush(Qt.blue))
        scene.addItem(item1)
        scene.addItem(item2)
        scene.addItem(item3)
        scene.addItem(item4) 
示例27
def setBlackoutColors(self):
        global colors
        global orange
        colors = [Qt.red, Qt.yellow, Qt.darkYellow, Qt.green, Qt.darkGreen, orange, Qt.blue,Qt.cyan, Qt.darkCyan, Qt.magenta, Qt.darkMagenta, Qt.gray]

        # return
        # self.setStyleSheet("background-color: black")
        #self.Plot24.setBackgroundBrush(Qt.black)
        mainTitleBrush = QBrush(Qt.red)
        self.chart24.setTitleBrush(mainTitleBrush)
        self.chart5.setTitleBrush(mainTitleBrush)
        
        self.chart24.setBackgroundBrush(QBrush(Qt.black))
        self.chart24.axisX().setLabelsColor(Qt.white)
        self.chart24.axisY().setLabelsColor(Qt.white)
        titleBrush = QBrush(Qt.white)
        self.chart24.axisX().setTitleBrush(titleBrush)
        self.chart24.axisY().setTitleBrush(titleBrush)
        #self.Plot5.setBackgroundBrush(Qt.black)
        self.chart5.setBackgroundBrush(QBrush(Qt.black))
        self.chart5.axisX().setLabelsColor(Qt.white)
        self.chart5.axisY().setLabelsColor(Qt.white)
        self.chart5.axisX().setTitleBrush(titleBrush)
        self.chart5.axisY().setTitleBrush(titleBrush)
        
        #$ self.networkTable.setStyleSheet("QTableCornerButton::section{background-color: white;}")
        # self.networkTable.cornerWidget().setStylesheet("background-color: black")
        self.networkTable.setStyleSheet("QTableView {background-color: black;gridline-color: white;color: white} QTableCornerButton::section{background-color: white;}")
        headerStyle = "QHeaderView::section{background-color: white;border: 1px solid black;color: black;} QHeaderView::down-arrow,QHeaderView::up-arrow {background: none;}"
        self.networkTable.horizontalHeader().setStyleSheet(headerStyle)
        self.networkTable.verticalHeader().setStyleSheet(headerStyle) 
示例28
def paintEvent(self, event):
        super(CColorControl, self).paintEvent(event)
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing, True)
        painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
        painter.setPen(Qt.NoPen)

        # 变换圆心
        painter.translate(self.rect().center())

        # 画背景方格图
        painter.save()
        # 保证方格在前景圆内部
        diameter = min(self.width(), self.height()) - 8
        radius = diameter / 2
        path = QPainterPath()
        path.addRoundedRect(-radius, -radius, diameter,
                            diameter, radius, radius)
        painter.setClipPath(path)

        pixSize = 5
        for x in range(int(self.width() / pixSize)):
            for y in range(int(self.height() / pixSize)):
                _x, _y = x * pixSize, y * pixSize
                painter.fillRect(_x - radius, _y - radius, pixSize, pixSize,
                                 Qt.white if x % 2 != y % 2 else Qt.darkGray)
        painter.restore()

        # 画前景颜色
        diameter = min(self.width(), self.height()) - 4
        radius = diameter / 2
        path = QPainterPath()
        path.addRoundedRect(-radius, -radius, diameter,
                            diameter, radius, radius)
        painter.setClipPath(path)

        painter.setBrush(self._color)
        painter.drawRoundedRect(-radius, -radius,
                                diameter, diameter, radius, radius) 
示例29
def _createPointer(self):
        # 绘制一个小圆环
        self._imagePointer = QImage(12, 12, QImage.Format_ARGB32)
        self._imagePointer.fill(Qt.transparent)
        painter = QPainter()
        painter.begin(self._imagePointer)
        painter.setRenderHint(QPainter.Antialiasing, True)
        painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
        painter.setPen(QPen(Qt.white, 2))
        painter.setBrush(Qt.NoBrush)
        path = QPainterPath()
        path.addRoundedRect(0, 0, 12, 12, 6.0, 6.0)
        painter.setClipPath(path)
        painter.drawRoundedRect(0, 0, 12, 12, 6.0, 6.0)
        painter.end() 
示例30
def Color(self, item):
        if item == 0:
            color = (self.vistaGrafico.backgroundBrush().color()
                     if self.vistaGrafico.backgroundBrush().color().isValid()
                     else QColor(Qt.white))
        elif item == 1:
            color = (self.vistaGrafico.chart().backgroundBrush().color()
                     if self.vistaGrafico.chart().backgroundBrush().color().isValid()
                     else QColor(Qt.white))
        elif item == 2:
            color = (self.vistaGrafico.chart().titleBrush().color()
                     if self.vistaGrafico.chart().titleBrush().color().isValid()
                     else QColor(Qt.black))
        elif item == 3:
            color = (self.vistaGrafico.chart().axisX().labelsBrush().color()
                     if self.vistaGrafico.chart().axisX().labelsBrush().color().isValid()
                     else QColor(Qt.black))
        elif item == 4:
            color = (self.vistaGrafico.chart().axisY().labelsBrush().color()
                     if self.vistaGrafico.chart().axisY().labelsBrush().color().isValid()
                     else QColor(Qt.black))
        elif item == 5:
            color = (self.vistaGrafico.chart().legend().labelColor()
                     if self.vistaGrafico.chart().legend().labelColor().isValid()
                     else QColor(Qt.black))
            
        color = QColorDialog.getColor(color, self)
        if color.isValid():
            if item == 0:
                self.vistaGrafico.setBackgroundBrush(color)
            elif item == 1:
                self.vistaGrafico.chart().setBackgroundBrush(color)
            elif item == 2:
                self.vistaGrafico.chart().setTitleBrush(color)
            elif item == 3:
                self.vistaGrafico.chart().axisX().setLabelsBrush(color)
            elif item == 4:
                self.vistaGrafico.chart().axisY().setLabelsBrush(color)
            elif item == 5:
                self.vistaGrafico.chart().legend().setLabelColor(color)