From 9c93fca09947ca8b67996aa8369ca98d2164c0e5 2012-08-14 12:45:32 From: sauimone Date: 2012-08-14 12:45:32 Subject: [PATCH] fix to QTRD-1519:Setting color for a BarSet has no effect. Theme was overriding the color, which was defined on QML side --- diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index 5fc26a3..c5caff9 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -481,8 +481,15 @@ QColor QBarSet::color() void QBarSet::setColor(QColor color) { QBrush b = brush(); - if (b.color() != color) { + if ((b.color() != color) || (b.style() == Qt::NoBrush)) { b.setColor(color); + if (b.style() == Qt::NoBrush) { + // Set tyle to Qt::SolidPattern. (Default is Qt::NoBrush) + // This prevents theme to override color defined in QML side: + // BarSet { label: "Bob"; color:"red"; values: [1,2,3] } + // The color must be obeyed, since user wanted it. + b.setStyle(Qt::SolidPattern); + } setBrush(b); emit colorChanged(color); }