From 924ed0da8578d43bf21c9155b9bf439108e74988 Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Tue, 8 May 2018 20:28:29 -0500 Subject: [PATCH] client: Fix Core Info session widget spacing Fix spacing for Core Info session widget by keeping only one stretch layout item and inserting before it, rather than manually adding stretches after every client list update. See https://doc.qt.io/qt-5/qboxlayout.html#insertWidget --- src/qtui/coreinfodlg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qtui/coreinfodlg.cpp b/src/qtui/coreinfodlg.cpp index e5eb7f4c..2f8736c1 100644 --- a/src/qtui/coreinfodlg.cpp +++ b/src/qtui/coreinfodlg.cpp @@ -59,7 +59,10 @@ void CoreInfoDlg::coreInfoChanged(const QVariantMap &coreInfo) { coreSessionWidget->setData(peerMap); if (isNew) { _widgets[peerId] = coreSessionWidget; - ui.coreSessionContainer->addWidget(coreSessionWidget); + // Add this to the end of the session list, but before the default layout stretch item. + // The layout stretch item should never be removed, so count should always be >= 1. + ui.coreSessionContainer->insertWidget(ui.coreSessionContainer->count() - 1, + coreSessionWidget, 0, Qt::AlignTop); connect(coreSessionWidget, SIGNAL(disconnectClicked(int)), this, SLOT(disconnectClicked(int))); } } @@ -70,7 +73,6 @@ void CoreInfoDlg::coreInfoChanged(const QVariantMap &coreInfo) { } ui.coreSessionScrollArea->setVisible(coreSessionSupported); - ui.coreSessionContainer->addStretch(1); } -- 2.20.1