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
coreSessionWidget->setData(peerMap);
if (isNew) {
_widgets[peerId] = coreSessionWidget;
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)));
}
}
connect(coreSessionWidget, SIGNAL(disconnectClicked(int)), this, SLOT(disconnectClicked(int)));
}
}
}
ui.coreSessionScrollArea->setVisible(coreSessionSupported);
}
ui.coreSessionScrollArea->setVisible(coreSessionSupported);
- ui.coreSessionContainer->addStretch(1);