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