Fix color of a line edit text in dark mode.

This commit is contained in:
Roman Telezhynskyi 2024-01-29 16:47:19 +02:00
parent a0c1b6a512
commit 0cd42f83e6
3 changed files with 11 additions and 7 deletions

View File

@ -459,7 +459,7 @@ void DialogSaveManualLayout::PathChanged(const QString &text)
if (not text.isEmpty() && dir.exists(text)) if (not text.isEmpty() && dir.exists(text))
{ {
bOk->setEnabled(true); bOk->setEnabled(true);
palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black); palette.setColor(ui->lineEditPath->foregroundRole(), palette.color(QPalette::Text));
} }
else else
{ {

View File

@ -332,11 +332,13 @@ void DialogPatternProperties::ValidatePassmarkLength() const
QRegularExpression rx(NameRegExp()); QRegularExpression rx(NameRegExp());
if (not text.isEmpty()) if (not text.isEmpty())
{ {
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red); palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text)
? palette.color(QPalette::Text)
: Qt::red);
} }
else else
{ {
palette.setColor(foregroundRole, Qt::black); palette.setColor(foregroundRole, palette.color(QPalette::Text));
} }
ui->lineEditPassmarkLength->setPalette(palette); ui->lineEditPassmarkLength->setPalette(palette);
@ -352,11 +354,13 @@ void DialogPatternProperties::ValidatePassmarkWidth() const
QRegularExpression rx(NameRegExp()); QRegularExpression rx(NameRegExp());
if (not text.isEmpty()) if (not text.isEmpty())
{ {
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red); palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text)
? palette.color(QPalette::Text)
: Qt::red);
} }
else else
{ {
palette.setColor(foregroundRole, Qt::black); palette.setColor(foregroundRole, palette.color(QPalette::Text));
} }
ui->lineEditPassmarkWidth->setPalette(palette); ui->lineEditPassmarkWidth->setPalette(palette);
@ -555,7 +559,7 @@ void DialogPatternProperties::LabelPathChanged(const QString &text)
{ {
QPalette palette = ui->lineEditPieceLabelPath->palette(); QPalette palette = ui->lineEditPieceLabelPath->palette();
palette.setColor(ui->lineEditPieceLabelPath->foregroundRole(), palette.setColor(ui->lineEditPieceLabelPath->foregroundRole(),
text.isEmpty() || QFileInfo::exists(text) ? Qt::black : Qt::red); text.isEmpty() || QFileInfo::exists(text) ? palette.color(QPalette::Text) : Qt::red);
ui->lineEditPieceLabelPath->setPalette(palette); ui->lineEditPieceLabelPath->setPalette(palette);
m_descriptionChanged = true; m_descriptionChanged = true;
} }

View File

@ -410,7 +410,7 @@ void DialogSaveLayout::PathChanged(const QString &text)
if (not text.isEmpty() && dir.exists(text)) if (not text.isEmpty() && dir.exists(text))
{ {
bOk->setEnabled(true); bOk->setEnabled(true);
palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black); palette.setColor(ui->lineEditPath->foregroundRole(), palette.color(QPalette::Text));
} }
else else
{ {