mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 19:13: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
|
|
@ -14,6 +14,7 @@
|
|||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
|
||||
class TabSupervisor;
|
||||
template <class Key, class T> class QMap;
|
||||
|
|
@ -24,8 +25,7 @@ GameSelectorQuickFilterToolBar::GameSelectorQuickFilterToolBar(QWidget *parent,
|
|||
const QMap<int, QString> &allGameTypes)
|
||||
: QWidget(parent), tabSupervisor(_tabSupervisor), model(_model)
|
||||
{
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout = QtUtils::makeLayout<QHBoxLayout>(this);
|
||||
mainLayout->setSpacing(5);
|
||||
|
||||
const GameFilterConfigs &filters = model->getFilters();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <libcockatrice/protocol/pb/session_commands.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/utility/passwordhasher.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <string>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
@ -53,8 +54,7 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
|
|||
avatarPic.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
avatarPic.setAlignment(Qt::AlignCenter);
|
||||
|
||||
auto *avatarLayout = new QHBoxLayout;
|
||||
avatarLayout->setContentsMargins(0, 0, 0, 0);
|
||||
auto *avatarLayout = QtUtils::makeLayout<QHBoxLayout>();
|
||||
avatarLayout->addStretch(1);
|
||||
avatarLayout->addWidget(&avatarPic, 3);
|
||||
avatarLayout->addStretch(1);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#include <libcockatrice/protocol/pb/response_get_games_of_user.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/utility/card_ref.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <qnumeric.h>
|
||||
#include <string>
|
||||
|
||||
|
|
@ -402,9 +403,7 @@ UserInfoPopup::UserInfoPopup(TabSupervisor *_ts,
|
|||
|
||||
void UserInfoPopup::buildUi()
|
||||
{
|
||||
auto *root = new QVBoxLayout(this);
|
||||
root->setContentsMargins(0, 0, 0, 0);
|
||||
root->setSpacing(0);
|
||||
auto *root = QtUtils::makeLayout<QVBoxLayout>(this, 0);
|
||||
|
||||
// Header
|
||||
header = new UserInfoHeaderWidget(this);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <QStringLiteral>
|
||||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
@ -31,9 +32,7 @@ QString sectionKey(UserListWidget::Section section)
|
|||
UserListPanelWidget::UserListPanelWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
auto *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout->setSpacing(2);
|
||||
auto *mainLayout = QtUtils::makeLayout<QVBoxLayout>(this, 2);
|
||||
|
||||
searchBar = new QLineEdit(this);
|
||||
searchBar->setClearButtonEnabled(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue