diff --git a/ApplicationCode/UserInterface/RiuNightchartsWidget.cpp b/ApplicationCode/UserInterface/RiuNightchartsWidget.cpp index e7c39d99dd..4a7225a422 100644 --- a/ApplicationCode/UserInterface/RiuNightchartsWidget.cpp +++ b/ApplicationCode/UserInterface/RiuNightchartsWidget.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiuNightchartsWidget.h" +#include "RiuGuiTheme.h" //-------------------------------------------------------------------------------------------------- /// @@ -89,6 +90,9 @@ void RiuNightchartsWidget::clear() m_chart.setLegendType( Nightcharts::Vertical ); m_chart.setShadows( false ); + auto col = RiuGuiTheme::getColorByVariableName( "textColor" ); + m_chart.setTextColor( col ); + m_marginLeft = 10; m_marginTop = 10; m_maxNameWidth = 0; diff --git a/ThirdParty/nightcharts/nightcharts.cpp b/ThirdParty/nightcharts/nightcharts.cpp index ae068a04cb..bb2ebd9ddd 100644 --- a/ThirdParty/nightcharts/nightcharts.cpp +++ b/ThirdParty/nightcharts/nightcharts.cpp @@ -45,6 +45,8 @@ Nightcharts::Nightcharts()//QPainter *painter) // Was originally uninitialized, and caused overflow issues and invalid drawing when running debug // Suggest rewrite and use locally defined aggregatedAngle (see below for usage) palpha = 0.0; + + textColor = QPalette().color(QPalette::Text); } Nightcharts::~Nightcharts() @@ -350,9 +352,6 @@ void Nightcharts::drawLegend(QPainter *painter) //double ptext = 25; double angle = palpha; painter->setPen(Qt::SolidLine); - - QPalette palette; - QColor textColor = palette.color(QPalette::Text); painter->setPen(textColor); switch(cltype) @@ -465,3 +464,11 @@ int Nightcharts::pieceCount() const { return pieces.count(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Nightcharts::setTextColor(const QColor& color) +{ + textColor = color; +} diff --git a/ThirdParty/nightcharts/nightcharts.h b/ThirdParty/nightcharts/nightcharts.h index 56cc0334c1..4f8ff93b6d 100644 --- a/ThirdParty/nightcharts/nightcharts.h +++ b/ThirdParty/nightcharts/nightcharts.h @@ -63,6 +63,7 @@ public: int draw(QPainter *painter); void drawLegend(QPainter *painter); int pieceCount() const; + void setTextColor(const QColor& color); double palpha; private: @@ -72,6 +73,7 @@ private: QVector pieces; int ctype, cltype; QFont font; + QColor textColor; //QPainter *cpainter; QPointF GetPoint(double angle, double R1 = 0, double R2 = 0); int GetQuater(double angle);