diff options
author | JiDe Zhang <zhangjide@uniontech.com> | 2022-07-03 11:38:34 +0800 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-07-08 17:09:04 +0000 |
commit | 1d961491d817490da156769ddce6fce48a0bce4a (patch) | |
tree | bca9e13b869020a2b9b00bee8679b663d33416b4 /tests/auto/gui/kernel/qpalette | |
parent | bea66711d81a0fc66cde6638297b2b297963cc94 (diff) |
Always update QPalette resolve mask, regardless of QBrush change
56bd1b76d2e81c58a80bf6b5d74219c6b1ab8499 changed the update
resolve mask behavior in QPalette to avoid detaching brush data
when modifying the resolve mask if the brush value is not changed.
But this behavior broke compatibility, it introduced unknown risks, and
we cannot ensure that other code in Qt does not depend on the old
behavior.
We both need to ensure that we don't detach when the value is not
changed, and ensure that the resolveMask is always updated regardless
of whether the value changes, so we need to split them up and
independently share the brush data.
QFont will update its corresponding resolveMask even if the value has
not changed, so it is better to correct this behavior so that QPalette
and QFont are consistent.
[ChangeLog][QtGui][QPalette] Always update resolve mask in
QPalette::setBrush, even if the value of brush has not changed.
Fixes: QTBUG-98762
Pick-to: 6.4 6.3 6.2
Change-Id: Ib845361b30f21c3d78c16ced923c1678b12e05ac
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel/qpalette')
-rw-r--r-- | tests/auto/gui/kernel/qpalette/tst_qpalette.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index 22aaaecf19..cdb6817598 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -190,9 +190,6 @@ void tst_QPalette::setBrush() const QPalette pp = p; QVERIFY(pp.isCopyOf(p)); - // Setting the same brush won't detach - p.setBrush(QPalette::Disabled, QPalette::Button, Qt::green); - QVERIFY(pp.isCopyOf(p)); } void tst_QPalette::isBrushSet() @@ -217,7 +214,7 @@ void tst_QPalette::isBrushSet() QVERIFY(!p2.isBrushSet(QPalette::Active, QPalette::Dark)); p2.setBrush(QPalette::Active, QPalette::Dark, p2.brush(QPalette::Active, QPalette::Dark)); QVERIFY(!p3.isBrushSet(QPalette::Active, QPalette::Dark)); - QVERIFY(!p2.isBrushSet(QPalette::Active, QPalette::Dark)); + QVERIFY(p2.isBrushSet(QPalette::Active, QPalette::Dark)); } void tst_QPalette::setAllPossibleBrushes() |