Get window text color from dialog palette. Set Ok color only for Active state.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-02-24 17:17:56 +02:00
parent edf2b2e74a
commit d9bf2d5d6c

View File

@ -86,18 +86,34 @@ Q_LOGGING_CATEGORY(vDialog, "v.dialog")
* @param parent parent widget * @param parent parent widget
*/ */
DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent)
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), flagError(true), : QDialog(parent),
timerFormula(nullptr), bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr), data(data),
labelResultCalculation(nullptr), labelEditNamePoint(nullptr), labelEditFormula(nullptr), isInitialized(false),
okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr), flagName(true),
toolId(toolId), prepare(false), pointName(QString()), number(0), vis(nullptr) flagFormula(true),
flagError(true),
timerFormula(nullptr),
bOk(nullptr),
bApply(nullptr),
spinBoxAngle(nullptr),
plainTextEditFormula(nullptr),
labelResultCalculation(nullptr),
labelEditNamePoint(nullptr),
labelEditFormula(nullptr),
okColor(this->palette().color(QPalette::Active, QPalette::WindowText)),
errorColor(Qt::red),
associatedTool(nullptr),
toolId(toolId),
prepare(false),
pointName(),
number(0),
vis(nullptr)
{ {
SCASSERT(data != nullptr) SCASSERT(data != nullptr)
timerFormula = new QTimer(this); timerFormula = new QTimer(this);
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogTool::~DialogTool() DialogTool::~DialogTool()
{ {
@ -922,7 +938,7 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color)
{ {
SCASSERT(widget != nullptr) SCASSERT(widget != nullptr)
QPalette palette = widget->palette(); QPalette palette = widget->palette();
palette.setColor(widget->foregroundRole(), color); palette.setColor(QPalette::Active, widget->foregroundRole(), color);
widget->setPalette(palette); widget->setPalette(palette);
} }