aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-06-03 21:46:48 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-06-04 10:17:07 +0000
commitae7c819eb5631af03d8270915ee4f5c57b739773 (patch)
tree96caeccecc79436882215b29fb8e8a2a19f86729
parente9afb38d5a762aeaea45e68be2ef0878493cfa12 (diff)
Native style: repaint image when geometry changes
When we don't use a nine-patch image for scaling, the size of the image will depend on the size of the item. So we need to repaint it whenever we update geometry. Change-Id: I385325621f5259e3e97ceb5e143ad73682f8b276 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/nativestyle/items/qquickstyleitem.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitem.cpp b/src/imports/nativestyle/items/qquickstyleitem.cpp
index 35e0f2ed..37ec9889 100644
--- a/src/imports/nativestyle/items/qquickstyleitem.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitem.cpp
@@ -264,9 +264,12 @@ void QQuickStyleItem::paintControlToImage()
void QQuickStyleItem::updatePolish()
{
- if (m_dirty.testFlag(DirtyFlag::Geometry))
+ const bool dirtyGeometry = m_dirty & DirtyFlag::Geometry;
+ const bool dirtyImage = (m_dirty & DirtyFlag::Image) || (!m_useNinePatchImage && dirtyGeometry);
+
+ if (dirtyGeometry)
updateGeometry();
- if (m_dirty.testFlag(DirtyFlag::Image))
+ if (dirtyImage)
paintControlToImage();
}