aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle/items/qquickstyleitem.cpp
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-27 16:27:01 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-28 11:51:19 +0100
commit7c48cf655580e118ee7faf21a9f346bd68292e26 (patch)
tree88216a0c76cf2093fe10e34b94b4c5de09517d03 /src/imports/nativestyle/items/qquickstyleitem.cpp
parent938f853ddcb1a7a86da703336a0a67ccd69aca54 (diff)
nativestyle: only draw the control if the control is visible
Check if the control is visible before taking the time to draw the image. Change-Id: Icb64b85355e1341279a95e9035ae18d91c14d6a8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/nativestyle/items/qquickstyleitem.cpp')
-rw-r--r--src/imports/nativestyle/items/qquickstyleitem.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitem.cpp b/src/imports/nativestyle/items/qquickstyleitem.cpp
index bf3d9129..b5005a8b 100644
--- a/src/imports/nativestyle/items/qquickstyleitem.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitem.cpp
@@ -220,6 +220,20 @@ void QQuickStyleItem::geometryChange(const QRectF &newGeometry, const QRectF &ol
markGeometryDirty();
}
+void QQuickStyleItem::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
+{
+ QQuickItem::itemChange(change, data);
+
+ switch (change) {
+ case QQuickItem::ItemVisibleHasChanged:
+ if (data.boolValue)
+ markImageDirty();
+ break;
+ default:
+ break;
+ }
+}
+
void QQuickStyleItem::updateGeometry()
{
qqc2DebugHeading("GEOMETRY");
@@ -321,7 +335,7 @@ void QQuickStyleItem::updatePolish()
QScopedValueRollback<bool> guard(m_polishing, true);
const bool dirtyGeometry = m_dirty & DirtyFlag::Geometry;
- const bool dirtyImage = (m_dirty & DirtyFlag::Image) || (!m_useNinePatchImage && dirtyGeometry);
+ const bool dirtyImage = isVisible() && ((m_dirty & DirtyFlag::Image) || (!m_useNinePatchImage && dirtyGeometry));
if (dirtyGeometry)
updateGeometry();