#6514 Dark Theme : Fix text color in nightcharts

This commit is contained in:
Magne Sjaastad 2020-09-16 14:32:14 +02:00 committed by Gaute Lindkvist
parent 0b44f6ab18
commit 2cfa900041
3 changed files with 16 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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<pieceNC> pieces;
int ctype, cltype;
QFont font;
QColor textColor;
//QPainter *cpainter;
QPointF GetPoint(double angle, double R1 = 0, double R2 = 0);
int GetQuater(double angle);