aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-06-04 14:51:36 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-06-04 15:52:24 +0000
commit53bfe56fc72000276c4f066de64ad1296bad496b (patch)
tree4f3fb28aeb902aed6a6961d6990c219d5e98803b
parent93586999198972600574a819223efc83560d8b51 (diff)
Native style: don't use padding when item is smaller than minimumsize
Set padding to 0 if the item is resized smaller than minimum, otherwise the image will be wrapped rather than scaled. Change-Id: I803f5d0ff93afcb1b03e936aae766e71675f8d33 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/nativestyle/items/qquickstyleitem.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitem.cpp b/src/imports/nativestyle/items/qquickstyleitem.cpp
index c6272efd..eac37bea 100644
--- a/src/imports/nativestyle/items/qquickstyleitem.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitem.cpp
@@ -115,7 +115,11 @@ QSGNode *QQuickStyleItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePa
node = window()->createNinePatchNode();
auto texture = window()->createTextureFromImage(m_paintedImage, QQuickWindow::TextureCanUseAtlas);
- const QSize padding = m_useNinePatchImage ? m_styleItemGeometry.minimumSize / 2 : QSize(0, 0);
+ QSize padding = m_useNinePatchImage ? m_styleItemGeometry.minimumSize / 2 : QSize(0, 0);
+ if (boundingRect().width() < m_styleItemGeometry.minimumSize.width())
+ padding.setWidth(0);
+ if (boundingRect().height() < m_styleItemGeometry.minimumSize.height())
+ padding.setHeight(0);
node->setBounds(boundingRect());