aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/layouts/qquicklayout_p.h
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2020-04-16 10:59:27 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2020-04-22 10:56:10 +0200
commite0a03d04f8880d81e0c1fec909e5892ae685af71 (patch)
tree0221cb03817b3dd725a0337dc833610b7ed507ee /src/imports/layouts/qquicklayout_p.h
parent0c28c42007e6e2adc3c65be03b8eaacd523698e7 (diff)
Add _q_dumpLayoutTree() for debugging purposes
I found this quite useful for debugging layouts in order to get a snapshot of the layout hierarchy at any point. It will show the hierarchy and the relevant properties that affect the layouting. It's basically QObject::dumpObjectTree() specialized for Qt Quick Layouts (except it will dump it as QML-ish). For the leaf nodes it will leave out unspecified information. Example on how a dump looks like: RowLayout { // Effective calculated values: sizeHintDirty: 1 sizeHint.min : [ 100, 20] sizeHint.pref: [ 100, 20] sizeHint.max : [ inf, 20] RowLayout { // Effective calculated values: sizeHintDirty: 1 sizeHint.min : [ 100, 20] sizeHint.pref: [ 100, 20] sizeHint.max : [ inf, 20] Rectangle { implicitWidth: 100 implicitHeight: 20 } Rectangle { implicitHeight: 20 Layout.fillWidth: true } } } Pick-to: 5.15 Change-Id: Ie2fcd56d522395cb9d6f55a1ea3f882a7a9da709 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/layouts/qquicklayout_p.h')
-rw-r--r--src/imports/layouts/qquicklayout_p.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/imports/layouts/qquicklayout_p.h b/src/imports/layouts/qquicklayout_p.h
index 8f208165e9..b85cf12c87 100644
--- a/src/imports/layouts/qquicklayout_p.h
+++ b/src/imports/layouts/qquicklayout_p.h
@@ -106,6 +106,9 @@ public:
void itemDestroyed(QQuickItem *item) override;
void itemVisibilityChanged(QQuickItem *item) override;
+ Q_INVOKABLE void _q_dumpLayoutTree() const;
+ void dumpLayoutTreeRecursive(int level, QString &buf) const;
+
protected:
void updatePolish() override;