From f8c82039e9b665cabaf605a3d363108e732d8205 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 23 Jul 2010 11:01:38 +0200 Subject: Revert "Make QPalette::operator== return false if the currentColorGroup differs" This reverts commit d9d877326b13c55dc33b1cac13f3ee70e8de62bf. The behavior change it implied was bigger than expected and made too many autotests fail. Will document better that the currentColorGroup is not taken into account when comparing palettes. --- src/gui/kernel/qpalette.cpp | 2 -- src/gui/widgets/qlineedit.cpp | 2 +- tests/auto/qpalette/tst_qpalette.cpp | 30 ------------------------------ tests/auto/qwidget/tst_qwidget.cpp | 6 +++--- 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 910dfa9..98e8f66 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -876,8 +876,6 @@ void QPalette::detach() */ bool QPalette::operator==(const QPalette &p) const { - if (p.currentColorGroup() != current_group) - return false; if (isCopyOf(p)) return true; for(int grp = 0; grp < (int)NColorGroups; grp++) { diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 98f0f44..1bffde1 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1946,7 +1946,7 @@ void QLineEdit::paintEvent(QPaintEvent *) if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){ flags |= QLineControl::DrawSelections; // Palette only used for selections/mask and may not be in sync - if (d->control->palette() != pal) + if(d->control->palette() != pal) d->control->setPalette(pal); } diff --git a/tests/auto/qpalette/tst_qpalette.cpp b/tests/auto/qpalette/tst_qpalette.cpp index 65eabbd..2501f8d 100644 --- a/tests/auto/qpalette/tst_qpalette.cpp +++ b/tests/auto/qpalette/tst_qpalette.cpp @@ -65,7 +65,6 @@ public slots: private slots: void roleValues_data(); void roleValues(); - void operators(); }; tst_QPalette::tst_QPalette() @@ -129,34 +128,5 @@ void tst_QPalette::roleValues() QCOMPARE(role, value); } -void tst_QPalette::operators() -{ - { - QPalette palette = qApp->palette(); - QPalette copy = palette; - QCOMPARE(palette.currentColorGroup(), copy.currentColorGroup()); - QCOMPARE(palette.resolve(), copy.resolve()); - QVERIFY(copy.isCopyOf(palette)); - - } - - { - QPalette palette = qApp->palette(); - QPalette copy = palette; - copy.setColor(QPalette::Base, palette.color(QPalette::Base).lighter()); - QVERIFY(palette != copy); - QVERIFY(!copy.isCopyOf(palette)); - } - - { - QPalette palette = qApp->palette(); - QPalette copy = palette; - copy.setCurrentColorGroup(QPalette::Inactive); - palette.setCurrentColorGroup(QPalette::Active); - QVERIFY(palette != copy); - } - -} - QTEST_MAIN(tst_QPalette) #include "tst_qpalette.moc" diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f0c40e8..2d559c8 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -988,8 +988,8 @@ void tst_QWidget::palettePropagation2() { // ! Note, the code below is executed in tst_QWidget's constructor. // QPalette palette; - // palette.setColor(QPalette::ToolTipBase, QColor(12, 13, 14)); - // palette.setColor(QPalette::Text, QColor(21, 22, 23)); + // font.setColor(QPalette::ToolTipBase, QColor(12, 13, 14)); + // font.setColor(QPalette::Text, QColor(21, 22, 23)); // qApp->setPalette(palette, "QPropagationTestWidget"); QWidget *root = new QWidget; @@ -1000,7 +1000,7 @@ void tst_QWidget::palettePropagation2() QWidget *child4 = new QWidget(child3); QWidget *child5 = new QWidget(child4); root->show(); - QTest::qWaitForWindowShown(root); + QTest::qWait(100); // These colors are unlikely to be imposed on the default palette of // QWidget ;-). -- cgit v0.12