diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-03-16 12:57:29 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-03-19 12:02:24 +0100 |
commit | f97daab7a6045f414d3cabb67a2bdee7de71d226 (patch) | |
tree | 8ab30ebcd94aefbdaa5de15a864044c7317b788b /src/widgets/kernel/qwidget.cpp | |
parent | 6ec1dc904d59bab3a0330ff2a6c26600a35c87a9 (diff) |
QObject: restore flags printing in dumpObjectTree()
This was lost when QtCore, QtGui and QtWidgets were split up. Restored
now via a virtual function on QObjectPrivate.
Chose to return std::string instead of QString or QByteArray because
its SSO is usually sufficient to hold these flag strings.
[ChangeLog][QtCore][QObject] Restored printing of Qt3-style
information from dumpObjectTree().
[ChangeLog][QtWidgets][QWidget] Restored printing of Qt3-style
information from QWidget::dumpObjectTree().
Fixes: QTBUG-101732
Change-Id: I39ff5728ea5f5abbdbf81b5d7e13b8d16b6ee8b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 3918a46da4..97a02899f8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -110,6 +110,8 @@ #include "qwindowcontainer_p.h" +#include <sstream> + // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG //#define ALIEN_DEBUG @@ -12961,6 +12963,25 @@ void QWidgetPrivate::setWidgetParentHelper(QObject *widgetAsObject, QObject *new widget->setParent(static_cast<QWidget*>(newParent)); } +std::string QWidgetPrivate::flagsForDumping() const +{ + Q_Q(const QWidget); + std::string flags = QObjectPrivate::flagsForDumping(); + if (QApplication::focusWidget() == q) + flags += 'F'; + if (q->isVisible()) { + std::stringstream s; + s << '<' + << q->width() << 'x' << q->height() + << std::showpos << q->x() << q->y() + << '>'; + flags += s.str(); + } else { + flags += 'I'; + } + return flags; +} + void QWidgetPrivate::setNetWmWindowTypes(bool skipIfMissing) { #if QT_CONFIG(xcb) |