commit b9ca608c2f7ca2e1434e8e7cfc9e9c83f643c6c4
Author: Juergen Spitzmueller <[email protected]>
Date: Thu Mar 17 08:47:43 2022 +0100
Properly color red checkbox labels in validation (part of #12508)
---
src/frontends/qt/qt_helpers.cpp | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index 1189032..8372fd9 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -223,11 +223,22 @@ bool ColorSorter(ColorCode lhs, ColorCode rhs)
void setValid(QWidget * widget, bool valid)
{
if (valid) {
- widget->setPalette(QPalette());
+ if (qobject_cast<QCheckBox*>(widget) != nullptr)
+ // Check boxes need to be treated differenty, see
+ // https://forum.qt.io/topic/93253/
+ widget->setStyleSheet("");
+ else
+ widget->setPalette(QPalette());
} else {
- QPalette pal = widget->palette();
- pal.setColor(QPalette::Active, QPalette::WindowText,
QColor(255, 0, 0));
- widget->setPalette(pal);
+ if (qobject_cast<QCheckBox*>(widget) != nullptr) {
+ // Check boxes need to be treated differenty, see
+ // https://forum.qt.io/topic/93253/
+ widget->setStyleSheet("QCheckBox:unchecked{ color: red;
}QCheckBox:checked{ color: red; }");
+ } else {
+ QPalette pal = widget->palette();
+ pal.setColor(QPalette::Active, QPalette::WindowText,
QColor(255, 0, 0));
+ widget->setPalette(pal);
+ }
}
}
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs