| 64 | } |
| 65 | |
| 66 | static void dumpLayoutTreeRecurse(QLayout *l, int *counter, int depth) |
| 67 | { |
| 68 | const QLatin1String colorOn(isZeroArea(l->geometry()) ? "\033[0m" : "\033[32m"); |
| 69 | const QLatin1String colorOff("\033[0m"); |
| 70 | |
| 71 | QString prolog = lineProlog(depth, *counter); |
| 72 | (*counter)++; |
| 73 | |
| 74 | qDebug() << colorOn + prolog << l->metaObject()->className() << l->geometry() |
| 75 | << "hint" << l->sizeHint() |
| 76 | << l->hasHeightForWidth() << "min" << l->minimumSize() |
| 77 | << "max" << l->maximumSize() |
| 78 | << l->expandingDirections() << l->alignment() |
| 79 | << colorOff; |
| 80 | for (int i = 0; i < l->count(); i++) { |
| 81 | QLayoutItem *child = l->itemAt(i); |
| 82 | if (QLayout *childL = child->layout()) { |
| 83 | dumpLayoutTreeRecurse(childL, counter, depth + 1); |
| 84 | } else { |
| 85 | // The isZeroArea check culls usually largely useless output - you might want to remove it in |
| 86 | // some debugging situations. Add a boolean parameter to this and dumpLayoutTree() if you do. |
| 87 | if (!isZeroArea(child->geometry())) { |
| 88 | prolog = lineProlog(depth + 1, *counter); |
| 89 | (*counter)++; |
| 90 | qDebug() << colorOn + prolog << typeid(*child).name() << child->geometry() |
| 91 | << "hint" << child->sizeHint() |
| 92 | << child->hasHeightForWidth() << "min" << child->minimumSize() |
| 93 | << "max" << child->maximumSize() |
| 94 | << child->expandingDirections() << child->alignment() |
| 95 | << colorOff; |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | static void dumpLayoutTree(QLayout *l) |
| 102 | { |
no test coverage detected