From 234da146237e95c1a070412deeacedeaa8ad368b Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 9 Dec 2003 10:33:55 +0000 Subject: [PATCH] Qt 2.3.x should now compile happily, JMarc, and you'll still get a red label when you try and input an invalid LyXLength in the external dialog. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8215 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 6 ++++++ src/frontends/qt2/checkedwidgets.C | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index ca3ea5b870..d9a81dc017 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,9 @@ +2003-12-09 Angus Leeming + + * checkedwidgets.C (setWarningColor): new function that should + work also with Qt 2.3.x. + (setWidget): call setWarningColor, not setPaletteForegroundColor. + 2003-12-08 Jean-Marc Lasgouttes * QExternal.C: add using directive diff --git a/src/frontends/qt2/checkedwidgets.C b/src/frontends/qt2/checkedwidgets.C index e01c54a2a8..5deef77b14 100644 --- a/src/frontends/qt2/checkedwidgets.C +++ b/src/frontends/qt2/checkedwidgets.C @@ -26,14 +26,25 @@ void addCheckedLineEdit(BCView & bcview, namespace { -void setWidget(bool valid, QLineEdit * input, QLabel * label) +void setWarningColor(QWidget * widget) { - QColor const red(255, 0, 0); + // Qt 2.3 does not have + // widget->setPaletteForegroundColor(QColor(255, 0, 0)); + // So copy the appropriate parts of the function here: + QPalette pal = widget->palette(); + pal.setColor(QPalette::Active, + QColorGroup::Foreground, + QColor(255, 0, 0)); + widget->setPalette(pal); +} + +void setWidget(bool valid, QLineEdit * input, QLabel * label) +{ if (valid) input->unsetPalette(); else - input->setPaletteForegroundColor(red); + setWarningColor(input); if (!label) return; @@ -41,7 +52,7 @@ void setWidget(bool valid, QLineEdit * input, QLabel * label) if (valid) label->unsetPalette(); else - label->setPaletteForegroundColor(red); + setWarningColor(label); } } // namespace anon -- 2.39.2