Saner size policies, no manual resize management.

Took 15 seconds

Took 23 seconds
This commit is contained in:
Lukas Brübach 2025-12-21 10:07:32 +01:00
parent 9e53f16e2f
commit 2cb31d440b
3 changed files with 2 additions and 11 deletions

View file

@ -22,6 +22,7 @@ DeckCardZoneDisplayWidget::DeckCardZoneDisplayWidget(QWidget *parent,
displayType(_displayType), bannerOpacity(bannerOpacity), subBannerOpacity(subBannerOpacity), displayType(_displayType), bannerOpacity(bannerOpacity), subBannerOpacity(subBannerOpacity),
cardSizeWidget(_cardSizeWidget) cardSizeWidget(_cardSizeWidget)
{ {
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout = new QVBoxLayout(this); layout = new QVBoxLayout(this);
setLayout(layout); setLayout(layout);
@ -171,16 +172,6 @@ void DeckCardZoneDisplayWidget::onCategoryRemoval(const QModelIndex &parent, int
} }
} }
void DeckCardZoneDisplayWidget::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
for (QObject *child : layout->children()) {
QWidget *widget = qobject_cast<QWidget *>(child);
if (widget) {
widget->setMaximumWidth(width());
}
}
}
void DeckCardZoneDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card) void DeckCardZoneDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card)
{ {
emit cardClicked(event, card, zoneName); emit cardClicked(event, card, zoneName);

View file

@ -40,7 +40,6 @@ public:
QPersistentModelIndex trackedIndex; QPersistentModelIndex trackedIndex;
QString zoneName; QString zoneName;
void addCardsToOverlapWidget(); void addCardsToOverlapWidget();
void resizeEvent(QResizeEvent *event) override;
public slots: public slots:
void onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card); void onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card);

View file

@ -175,6 +175,7 @@ void VisualDeckEditorWidget::initializeScrollAreaAndZoneContainer()
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
zoneContainer = new QWidget(scrollArea); zoneContainer = new QWidget(scrollArea);
zoneContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
zoneContainerLayout = new QVBoxLayout(zoneContainer); zoneContainerLayout = new QVBoxLayout(zoneContainer);
zoneContainer->setLayout(zoneContainerLayout); zoneContainer->setLayout(zoneContainerLayout);
scrollArea->addScrollBarWidget(zoneContainer, Qt::AlignHCenter); scrollArea->addScrollBarWidget(zoneContainer, Qt::AlignHCenter);