mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 21:40:00 -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
|
|
@ -16,6 +16,7 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QSizePolicy>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <optional>
|
||||
#include <qnamespace.h>
|
||||
|
||||
|
|
@ -26,8 +27,7 @@ DeckPreviewDeckTagsDisplayWidget::DeckPreviewDeckTagsDisplayWidget(QWidget *_par
|
|||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
|
||||
// Create layout
|
||||
auto *layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
auto *layout = QtUtils::makeLayout<QHBoxLayout>(this);
|
||||
|
||||
setFixedHeight(100);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
|
||||
DeckPreviewTagItemWidget::DeckPreviewTagItemWidget(const QString &tagName, bool isChecked, QWidget *parent)
|
||||
: QWidget(parent), checkBox_(new QCheckBox(this))
|
||||
{
|
||||
auto *layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(5);
|
||||
auto *layout = QtUtils::makeLayout<QHBoxLayout>(this, 5);
|
||||
|
||||
checkBox_->setText(tagName); // Set the tag name as the checkbox label
|
||||
checkBox_->setChecked(isChecked); // Set the initial state of the checkbox
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
PublicDeckPreviewWidget::PublicDeckPreviewWidget(QWidget *parent, const RemotePublicDecksModel::DeckEntry &entry)
|
||||
|
|
@ -36,8 +37,7 @@ PublicDeckPreviewWidget::PublicDeckPreviewWidget(QWidget *parent, const RemotePu
|
|||
tagsFlowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||
tagsFlowWidget->setSpacing(3, 3);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
auto *layout = QtUtils::makeLayout<QVBoxLayout>(this);
|
||||
layout->addWidget(bannerCardDisplayWidget);
|
||||
layout->addWidget(uploadTimeLabel);
|
||||
layout->addWidget(colorIdentityWidget);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <QLineEdit>
|
||||
#include <QStringLiteral>
|
||||
#include <QTimer>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
|
||||
/**
|
||||
* @brief Constructs a search bar for filtering decks in the Visual Deck Storage.
|
||||
|
|
@ -20,8 +21,7 @@
|
|||
*/
|
||||
VisualDeckStorageSearchWidget::VisualDeckStorageSearchWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout = QtUtils::makeLayout<QHBoxLayout>(this);
|
||||
setLayout(layout);
|
||||
|
||||
searchBar = new QLineEdit(this);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
|
||||
VisualDeckStorageSortWidget::VisualDeckStorageSortWidget(VisualDeckStorageWidget *parent) : QWidget(parent)
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout = QtUtils::makeLayout<QHBoxLayout>(this);
|
||||
setLayout(layout);
|
||||
|
||||
// Initialize the ComboBox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue