Skip to content

Commit

Permalink
DebugWidgetViewer: add more debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsergio committed Jul 17, 2024
1 parent d57d050 commit a148f6a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/qtwidgets/DebugWidgetViewer_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,17 @@ class DebugWidgetViewer : public QWidget
name += QStringLiteral("[%1]").arg(w->objectName());
}

QWidget *parentWidget = w->parentWidget();
if (parentWidget && !w->isWindow() && !w->geometry().intersects(parentWidget->rect())) {
qDebug() << "Widget out of bounds! w=" << w << "; geometry=" << w->geometry() << "; parentSize=" << parentWidget->size();
}

auto item = new QStandardItem(name);
item->setData(QVariant::fromValue(w), WidgetRole);
item->setData(pixmapForWidget(w), PixmapRole);

item->setCheckable(true);
item->setCheckState(Qt::Checked);

const int indexToInsert = parentItem->rowCount();
parentItem->insertRow(indexToInsert, item);

Expand Down Expand Up @@ -203,7 +208,8 @@ class DebugWidgetViewer : public QWidget
<< "\n autoFillBackground=" << widget->autoFillBackground()
<< "\n Window=" << widget->palette().color(QPalette::Window)
<< "\n Base=" << widget->palette().color(QPalette::Base)
<< "\n Button=" << widget->palette().color(QPalette::Button);
<< "\n Button=" << widget->palette().color(QPalette::Button)
<< "\n HWND=" << widget->windowHandle();

if (auto mw = qobject_cast<QMainWindow *>(widget)) {
qDebug() << " centralWidget=" << mw->centralWidget();
Expand Down

0 comments on commit a148f6a

Please sign in to comment.