From 0cd42f83e68f8393140e20d54f819a50035d683b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 29 Jan 2024 16:47:19 +0200 Subject: [PATCH] Fix color of a line edit text in dark mode. --- src/app/puzzle/dialogs/dialogsavemanuallayout.cpp | 2 +- .../valentina/dialogs/dialogpatternproperties.cpp | 14 +++++++++----- src/app/valentina/dialogs/dialogsavelayout.cpp | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp b/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp index 6c12b0fa7..dcad2c6ff 100644 --- a/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp +++ b/src/app/puzzle/dialogs/dialogsavemanuallayout.cpp @@ -459,7 +459,7 @@ void DialogSaveManualLayout::PathChanged(const QString &text) if (not text.isEmpty() && dir.exists(text)) { bOk->setEnabled(true); - palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black); + palette.setColor(ui->lineEditPath->foregroundRole(), palette.color(QPalette::Text)); } else { diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index cc9a005e8..1b6ed3cfd 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -332,11 +332,13 @@ void DialogPatternProperties::ValidatePassmarkLength() const QRegularExpression rx(NameRegExp()); 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 { - palette.setColor(foregroundRole, Qt::black); + palette.setColor(foregroundRole, palette.color(QPalette::Text)); } ui->lineEditPassmarkLength->setPalette(palette); @@ -352,11 +354,13 @@ void DialogPatternProperties::ValidatePassmarkWidth() const QRegularExpression rx(NameRegExp()); 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 { - palette.setColor(foregroundRole, Qt::black); + palette.setColor(foregroundRole, palette.color(QPalette::Text)); } ui->lineEditPassmarkWidth->setPalette(palette); @@ -555,7 +559,7 @@ void DialogPatternProperties::LabelPathChanged(const QString &text) { QPalette palette = ui->lineEditPieceLabelPath->palette(); 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); m_descriptionChanged = true; } diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index a2769981e..9be9a4730 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -410,7 +410,7 @@ void DialogSaveLayout::PathChanged(const QString &text) if (not text.isEmpty() && dir.exists(text)) { bOk->setEnabled(true); - palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black); + palette.setColor(ui->lineEditPath->foregroundRole(), palette.color(QPalette::Text)); } else {