sqlbrowser example: fix ugly margin around ConnectionWidget

When a layout is used to arrange the children of a non-top-level
custom widget, the layout's contentsMargins need to be manually set to
zero to avoid extra empty space around the widgets, misaligning it
w.r.t. its siblings.

Add the necessary call.

Amends 2690822428, which, however,
inherited the missing margin adjustment from older code.

Change-Id: Icd1945a4f2b1635f031e50758ec2f1ec9313ae27
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15524d1623a1400e4de15e57408e37020d394986)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 101fedb17f1d12ba49d09ac8ac5ca9ba9e28f828)
bb10
Marc Mutz 2024-12-31 10:03:41 +01:00 committed by Qt Cherry-pick Bot
parent 2403770dc2
commit 29edacac7a
1 changed files with 1 additions and 0 deletions

View File

@ -14,6 +14,7 @@ ConnectionWidget::ConnectionWidget(QWidget *parent)
, tree(new QTreeWidget(this))
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins({});
tree->setHeaderLabels(QStringList(tr("Database")));
tree->header()->setStretchLastSection(true);
QAction *refreshAction = new QAction(tr("Refresh"), tree);