aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-06-11 15:20:29 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-06-12 07:38:36 +0000
commit855475a8351b4619c272355371ef30ac771a01b7 (patch)
treec51548df9684afe16d6220ff1c49e3049f01402f /src
parent4013c4eef4857363274f0bec7176d7f313e0f83f (diff)
Native style: draw contentRect using margins
We need to draw the debug rect using the calculated margins. Otherwise the rect will be drawn wrong once the control is resized. Change-Id: Ieb188900c688205147f991b98b5aeee836571e3d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/nativestyle/items/qquickstyleitem.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitem.cpp b/src/imports/nativestyle/items/qquickstyleitem.cpp
index 03de717e..350a143b 100644
--- a/src/imports/nativestyle/items/qquickstyleitem.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitem.cpp
@@ -270,8 +270,12 @@ void QQuickStyleItem::paintControlToImage()
rect.adjust(m.left(), m.top(), -m.right(), -m.bottom());
painter.drawRect(rect);
}
- if (m_debugFlags.testFlag(ShowContentRect))
- painter.drawRect(m_styleItemGeometry.contentRect);
+ if (m_debugFlags.testFlag(ShowContentRect)) {
+ const auto p = contentPadding();
+ QRect rect = QRect(QPoint(0, 0), m_paintedImage.size() / scale);
+ rect.adjust(p.left(), p.top(), -p.right(), -p.bottom());
+ painter.drawRect(rect);
+ }
if (m_debugFlags.testFlag(ShowInputContentSize)) {
const int offset = 2;
const QPoint p = m_styleItemGeometry.contentRect.topLeft();