aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-06-15 12:45:03 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-16 09:59:50 +0000
commit9569779c37c2d98f8550a917b7274baffd4ae6c0 (patch)
tree42a2a2a38db046d1e1b24d2c79cbbb78668f96b5 /src
parent3248c0242c43f8e4251013a7a7c2fe39687553e9 (diff)
Avoid unnecessary palette allocations
The palette provider allocates QQuickPalette instances lazily in the palette() implementation. Since we only only test here whether a palette is present, uses the non-mutating providesPalette instead. As a drive-by, remove the paletteData() check from setCurrentColorGroup; paletteData() asserts if it would return nullptr, so this check is wrong and misleading. Amends 3675f2b235f32e05cf6d754e81e0e8f8ddd59752. Change-Id: I9701b3520998ec538ef560106a6c6078e7f1c4d8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 7b5c1063de0034d4b9e4345b9493aa3beba62a89) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickitem.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 5b8048c303..ff269363bb 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -8507,7 +8507,7 @@ bool QQuickItem::event(QEvent *ev)
break;
case QEvent::WindowActivate:
case QEvent::WindowDeactivate:
- if (d->palette())
+ if (d->providesPalette())
d->setCurrentColorGroup();
for (QQuickItem *item : d->childItems)
QCoreApplication::sendEvent(item, ev);