aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-11-02 13:47:23 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-11-02 15:14:14 +0100
commit11057b37220eb1b2d6d0cb267f7ab8f4afa91901 (patch)
tree0a8ba6ee3a9b22a02147b08e7df502b845a44f64 /src/imports
parent7ba3e74e3a3f87b6eb2e1742bfe0c9a1f28320cb (diff)
Native style: add separate Info debug flag
Add an extra debug flag that lets us distinguish between general information, like geometry info, and explicit debug statements. E.g when writing: qqc2Debug() << "entering this block" ...you sometimes only want to print that line, and not all the additional "noise" you also get if this would print out general information. Change-Id: I86f60557f7c9b08e24c3de55bd0d526e095c6104 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/nativestyle/items/qquickstyleitem.cpp15
-rw-r--r--src/imports/nativestyle/items/qquickstyleitem.h27
2 files changed, 23 insertions, 19 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitem.cpp b/src/imports/nativestyle/items/qquickstyleitem.cpp
index 902ccea9..506392cb 100644
--- a/src/imports/nativestyle/items/qquickstyleitem.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitem.cpp
@@ -123,7 +123,7 @@ QSGNode *QQuickStyleItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePa
#ifdef QT_DEBUG
if (m_debugFlags.testFlag(Unscaled)) {
bounds = QRectF(QPointF(), ninePatchImageSize);
- qqc2Debug() << "Setting paint node bounds to size of image:" << bounds;
+ qqc2Info() << "Setting paint node bounds to size of image:" << bounds;
}
#endif
@@ -209,7 +209,7 @@ void QQuickStyleItem::initStyleOptionBase(QStyleOption &styleOption) const
styleOption.state &= ~QStyle::State_MouseOver;
}
- qqc2Debug() << styleOption;
+ qqc2Info() << styleOption;
}
void QQuickStyleItem::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -239,7 +239,7 @@ void QQuickStyleItem::itemChange(QQuickItem::ItemChange change, const QQuickItem
void QQuickStyleItem::updateGeometry()
{
- qqc2DebugHeading("GEOMETRY");
+ qqc2InfoHeading("GEOMETRY");
m_dirty.setFlag(DirtyFlag::Geometry, false);
const QQuickStyleMargins oldContentPadding = contentPadding();
@@ -257,7 +257,7 @@ void QQuickStyleItem::updateGeometry()
// If the item has no contents (or its size is
// empty), we just use the minimum size as implicit size.
m_styleItemGeometry.implicitSize = m_styleItemGeometry.minimumSize;
- qqc2Debug() << "implicitSize is empty, using minimumSize instead";
+ qqc2Info() << "implicitSize is empty, using minimumSize instead";
}
if (contentPadding() != oldContentPadding)
@@ -269,7 +269,7 @@ void QQuickStyleItem::updateGeometry()
setImplicitSize(m_styleItemGeometry.implicitSize.width(), m_styleItemGeometry.implicitSize.height());
- qqc2Debug() << m_styleItemGeometry
+ qqc2Info() << m_styleItemGeometry
<< "bounding rect:" << boundingRect()
<< "layout margins:" << layoutMargins()
<< "content padding:" << contentPadding()
@@ -278,7 +278,7 @@ void QQuickStyleItem::updateGeometry()
void QQuickStyleItem::paintControlToImage()
{
- qqc2DebugHeading("PAINT");
+ qqc2InfoHeading("PAINT");
if (m_styleItemGeometry.minimumSize.isEmpty())
return;
@@ -371,7 +371,7 @@ void QQuickStyleItem::addDebugInfo()
#define QQC2_DEBUG_FLAG(FLAG) \
if (debugString.contains(QLatin1String(#FLAG), Qt::CaseInsensitive)) m_debugFlags |= FLAG
- QQC2_DEBUG_FLAG(Output);
+ QQC2_DEBUG_FLAG(Info);
QQC2_DEBUG_FLAG(ImageRect);
QQC2_DEBUG_FLAG(ContentRect);
QQC2_DEBUG_FLAG(LayoutRect);
@@ -379,6 +379,7 @@ void QQuickStyleItem::addDebugInfo()
QQC2_DEBUG_FLAG(DontUseNinePatchImage);
QQC2_DEBUG_FLAG(NinePatchMargins);
QQC2_DEBUG_FLAG(Unscaled);
+ QQC2_DEBUG_FLAG(Debug);
if (m_debugFlags & (DontUseNinePatchImage
| InputContentSize
diff --git a/src/imports/nativestyle/items/qquickstyleitem.h b/src/imports/nativestyle/items/qquickstyleitem.h
index 5bb990f4..f7659a5c 100644
--- a/src/imports/nativestyle/items/qquickstyleitem.h
+++ b/src/imports/nativestyle/items/qquickstyleitem.h
@@ -56,11 +56,13 @@
#endif
#ifdef QT_DEBUG
-#define qqc2Debug() if (m_debugFlags.testFlag(Output)) qDebug() << __FUNCTION__ << ":"
-#define qqc2DebugHeading(HEADING) if (m_debugFlags.testFlag(Output)) qDebug() << "--------" << HEADING << "--------"
+#define qqc2Debug() if (m_debugFlags.testFlag(Debug)) qDebug() << __FUNCTION__ << ":"
+#define qqc2Info() if (m_debugFlags.testFlag(Info)) qDebug() << __FUNCTION__ << ":"
+#define qqc2InfoHeading(HEADING) if (m_debugFlags.testFlag(Info)) qDebug() << "--------" << HEADING << "--------"
#else
#define qqc2Debug() if (false) qDebug()
-#define qqc2DebugHeading(HEADING) if (false) qDebug()
+#define qqc2Info() if (false) qDebug()
+#define qqc2InfoHeading(HEADING) if (false) qDebug()
#endif
QT_BEGIN_NAMESPACE
@@ -190,15 +192,16 @@ public:
#ifdef QT_DEBUG
enum DebugFlag {
- NoDebug = 0x00,
- Output = 0x01,
- ImageRect = 0x02,
- ContentRect = 0x04,
- LayoutRect = 0x08,
- Unscaled = 0x10,
- InputContentSize = 0x20,
- DontUseNinePatchImage = 0x40,
- NinePatchMargins = 0x80
+ NoDebug = 0x000,
+ Debug = 0x001,
+ Info = 0x002,
+ ImageRect = 0x003,
+ ContentRect = 0x008,
+ LayoutRect = 0x010,
+ Unscaled = 0x020,
+ InputContentSize = 0x040,
+ DontUseNinePatchImage = 0x080,
+ NinePatchMargins = 0x100,
};
Q_FLAG(DebugFlag)
Q_DECLARE_FLAGS(DebugFlags, DebugFlag)