mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 21:13:55 -07:00
Set spacings.
Took 12 minutes
This commit is contained in:
parent
80a1ba0ce9
commit
b785574d2f
5 changed files with 18 additions and 0 deletions
|
|
@ -40,7 +40,15 @@ public:
|
||||||
[[nodiscard]] QSize minimumSize() const override;
|
[[nodiscard]] QSize minimumSize() const override;
|
||||||
|
|
||||||
// Spacing helpers
|
// Spacing helpers
|
||||||
|
void setHorizontalMargin(int margin)
|
||||||
|
{
|
||||||
|
horizontalMargin = margin;
|
||||||
|
}
|
||||||
[[nodiscard]] int horizontalSpacing() const;
|
[[nodiscard]] int horizontalSpacing() const;
|
||||||
|
void setVerticalMargin(int margin)
|
||||||
|
{
|
||||||
|
verticalMargin = margin;
|
||||||
|
}
|
||||||
[[nodiscard]] int verticalSpacing() const;
|
[[nodiscard]] int verticalSpacing() const;
|
||||||
[[nodiscard]] int smartSpacing(QStyle::PixelMetric pm) const;
|
[[nodiscard]] int smartSpacing(QStyle::PixelMetric pm) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ DrawProbabilityWidget::DrawProbabilityWidget(QWidget *parent, DeckListStatistics
|
||||||
: AbstractAnalyticsPanelWidget(parent, analyzer)
|
: AbstractAnalyticsPanelWidget(parent, analyzer)
|
||||||
{
|
{
|
||||||
controls = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
controls = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
||||||
|
controls->setSpacing(4, 4);
|
||||||
|
|
||||||
labelPrefix = new QLabel(this);
|
labelPrefix = new QLabel(this);
|
||||||
controls->addWidget(labelPrefix);
|
controls->addWidget(labelPrefix);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ DeckAnalyticsWidget::DeckAnalyticsWidget(QWidget *parent, DeckListStatisticsAnal
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
controlContainer = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
controlContainer = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
||||||
|
controlContainer->setSpacing(4, 4);
|
||||||
addButton = new QPushButton(this);
|
addButton = new QPushButton(this);
|
||||||
removeButton = new QPushButton(this);
|
removeButton = new QPushButton(this);
|
||||||
saveButton = new QPushButton(this);
|
saveButton = new QPushButton(this);
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,13 @@ void FlowWidget::resizeEvent(QResizeEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlowWidget::setSpacing(int hSpacing, int vSpacing)
|
||||||
|
{
|
||||||
|
flowLayout->setHorizontalMargin(hSpacing);
|
||||||
|
flowLayout->setVerticalMargin(vSpacing);
|
||||||
|
flowLayout->invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets every child widget's minimum size to the largest sizeHint in the layout.
|
* @brief Sets every child widget's minimum size to the largest sizeHint in the layout.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setMinimumSizeToMaxSizeHint();
|
void setMinimumSizeToMaxSizeHint();
|
||||||
|
void setSpacing(int hSpacing, int vSpacing);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue