aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle/items/qquickstyleitem.cpp
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-11-19 19:15:18 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-01-13 15:36:54 +0100
commitdfb6b2902d1bbe61003ad66218496f5a68d7c47d (patch)
treea9406ab96b683af1ac474274d3def825cf9a2e90 /src/imports/nativestyle/items/qquickstyleitem.cpp
parent435ddb66acfa0dc7fa086577df4975d9ed0a3d47 (diff)
QQuickStyleItem: add debug flag 'SaveImage'
Change-Id: Ifbaadd993924022b1351927aaf3987cb94c74df8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/imports/nativestyle/items/qquickstyleitem.cpp')
-rw-r--r--src/imports/nativestyle/items/qquickstyleitem.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitem.cpp b/src/imports/nativestyle/items/qquickstyleitem.cpp
index 0cc94b42..23f290d3 100644
--- a/src/imports/nativestyle/items/qquickstyleitem.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitem.cpp
@@ -37,6 +37,7 @@
#include "qquickstyleitem.h"
#include <QtCore/qscopedvaluerollback.h>
+#include <QtCore/qdir.h>
#include <QtQuick/qsgninepatchnode.h>
#include <QtQuick/private/qquickwindow_p.h>
@@ -379,6 +380,15 @@ void QQuickStyleItem::paintControlToImage()
painter.drawLine(0, imgSize.height() - m.bottom(), imgSize.width(), imgSize.height() - m.bottom());
}
}
+ if (m_debugFlags.testFlag(SaveImage)) {
+ static int nr = -1;
+ ++nr;
+ static QString filename = QStringLiteral("styleitem_saveimage_");
+ const QString path = QDir::current().absoluteFilePath(filename);
+ const QString name = path + QString::number(nr) + QStringLiteral(".png");
+ m_paintedImage.save(name);
+ qDebug() << "image saved to:" << name;
+ }
}
#endif
@@ -432,6 +442,7 @@ void QQuickStyleItem::addDebugInfo()
QQC2_DEBUG_FLAG(NinePatchMargins);
QQC2_DEBUG_FLAG(Unscaled);
QQC2_DEBUG_FLAG(Debug);
+ QQC2_DEBUG_FLAG(SaveImage);
if (m_debugFlags & (DontUseNinePatchImage
| InputContentSize