diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-11-19 19:15:18 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2021-01-13 15:36:54 +0100 |
commit | dfb6b2902d1bbe61003ad66218496f5a68d7c47d (patch) | |
tree | a9406ab96b683af1ac474274d3def825cf9a2e90 /src/imports/nativestyle/items/qquickstyleitem.cpp | |
parent | 435ddb66acfa0dc7fa086577df4975d9ed0a3d47 (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.cpp | 11 |
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 |