[QtUtils] Use makeLayout() for zero-margin layouts (#7620)

* [QtUtils] Add parent lookup, layout clearing, scroll area and monospace helpers

* [QtUtils] Adopt shared Qt helpers across the client

* [QtUtils] Add layout creation and relayout helpers

* Swap parameter order (spacing before margin) and remove static from relayout()

* [QtUtils] Use relayout() after rebuilding dynamic layouts

* [QtUtils] Use makeLayout() for zero-margin layouts

* Consolidate setSpacing() calls into makeLayout() using new parameter order

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-24 19:06:18 +02:00 • committed by GitHub
parent 06b9ca368f
commit e806085681
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 116 additions and 175 deletions

View file

@ -17,6 +17,7 @@
#include <QVBoxLayout>
#include <QWidget>
#include <libcockatrice/settings/visual_deck_storage_settings.h>
#include <libcockatrice/utility/qt_utils.h>
DlgDefaultTagsEditor::DlgDefaultTagsEditor(QWidget *parent) : QDialog(parent)
{
@ -120,8 +121,7 @@ void DlgDefaultTagsEditor::addItem()
// Add new tag
auto *item = new QListWidgetItem(listWidget);
QWidget *widget = new QWidget(this);
QHBoxLayout *layout = new QHBoxLayout(widget);
layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout = QtUtils::makeLayout<QHBoxLayout>(widget);
// Editable tag label
QLineEdit *lineEdit = new QLineEdit(newTag, this);

View file

@ -84,8 +84,7 @@ DlgSelectSetForCards::DlgSelectSetForCards(QWidget *parent, DeckStateManager *de
// Left container
QWidget *leftContainer = new QWidget(this);
QVBoxLayout *leftLayout = new QVBoxLayout(leftContainer);
leftLayout->setContentsMargins(0, 0, 0, 0);
QVBoxLayout *leftLayout = QtUtils::makeLayout<QVBoxLayout>(leftContainer);
uneditedCardsLabel = new QLabel(this);
uneditedCardsArea = QtUtils::makeScrollArea(this);
@ -100,8 +99,7 @@ DlgSelectSetForCards::DlgSelectSetForCards(QWidget *parent, DeckStateManager *de
// Right container
QWidget *rightContainer = new QWidget(this);
QVBoxLayout *rightLayout = new QVBoxLayout(rightContainer);
rightLayout->setContentsMargins(0, 0, 0, 0);
QVBoxLayout *rightLayout = QtUtils::makeLayout<QVBoxLayout>(rightContainer);
modifiedCardsLabel = new QLabel(this);
modifiedCardsArea = QtUtils::makeScrollArea(this);