mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 11:03:25 -08:00
[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:
parent
06b9ca368f
commit
e806085681
56 changed files with 116 additions and 175 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include <QVariant>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
class QModelIndex;
|
||||
|
|
@ -42,9 +43,7 @@ CardAmountWidget::CardAmountWidget(QWidget *parent,
|
|||
: QWidget(parent), deckStateManager(deckStateManager), cardSizeSlider(cardSizeSlider), rootCard(rootCard),
|
||||
zoneName(zoneName), hovered(false)
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(10);
|
||||
layout = QtUtils::makeLayout<QHBoxLayout>(this, 10);
|
||||
this->setLayout(layout);
|
||||
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/utility/macros.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
/**
|
||||
|
|
@ -84,9 +85,7 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
|
|||
displayOptionsWidget->addSettingsWidget(cardSizeWidget);
|
||||
|
||||
sortAndOptionsContainer = new QWidget(this);
|
||||
sortAndOptionsLayout = new QHBoxLayout(sortAndOptionsContainer);
|
||||
sortAndOptionsLayout->setSpacing(3);
|
||||
sortAndOptionsLayout->setContentsMargins(0, 0, 0, 0);
|
||||
sortAndOptionsLayout = QtUtils::makeLayout<QHBoxLayout>(sortAndOptionsContainer, 0, 3);
|
||||
sortAndOptionsContainer->setLayout(sortAndOptionsLayout);
|
||||
|
||||
searchBar = new PrintingSelectorCardSearchWidget(this);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/card/relation/card_relation.h>
|
||||
#include <libcockatrice/settings/card_override_settings.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
class DeckStateManager;
|
||||
|
|
@ -108,9 +109,7 @@ PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget(QWidget *pa
|
|||
: QWidget(parent), deckEditor(_deckEditor), rootCard(_rootCard)
|
||||
{
|
||||
// Set up the main layout
|
||||
auto *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout->setSpacing(0);
|
||||
auto *mainLayout = QtUtils::makeLayout<QVBoxLayout>(this, 0);
|
||||
setLayout(mainLayout);
|
||||
|
||||
// Add CardInfoPictureWidget
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <QRect>
|
||||
#include <QSizePolicy>
|
||||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
/**
|
||||
|
|
@ -19,8 +20,7 @@ SetNameAndCollectorsNumberDisplayWidget::SetNameAndCollectorsNumberDisplayWidget
|
|||
: QWidget(parent)
|
||||
{
|
||||
// Set up the layout for the widget
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout = QtUtils::makeLayout<QVBoxLayout>(this);
|
||||
layout->setSpacing(1);
|
||||
setLayout(layout);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue