mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 17:02:15 -07:00
Boop the mainboard/sideboard label and the cardCount after a little bit of delay to make sure they initialize at the right size.
This commit is contained in:
parent
21e4aa8021
commit
2d59540f15
2 changed files with 8 additions and 3 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "../general/display/shadow_background_label.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
AllZonesCardAmountWidget::AllZonesCardAmountWidget(QWidget *parent,
|
||||
TabDeckEditor *deckEditor,
|
||||
DeckListModel *deckModel,
|
||||
|
|
@ -32,7 +34,10 @@ AllZonesCardAmountWidget::AllZonesCardAmountWidget(QWidget *parent,
|
|||
layout->addWidget(buttonBoxSideboard, 0, Qt::AlignHCenter | Qt::AlignTop);
|
||||
|
||||
connect(cardSizeSlider, &QSlider::valueChanged, this, &AllZonesCardAmountWidget::adjustFontSize);
|
||||
adjustFontSize(cardSizeSlider->value());
|
||||
|
||||
QTimer::singleShot(10, this, [this]() {
|
||||
adjustFontSize(this->cardSizeSlider->value());
|
||||
});
|
||||
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ CardAmountWidget::CardAmountWidget(QWidget *parent,
|
|||
|
||||
// Connect slider for dynamic font size adjustment
|
||||
connect(cardSizeSlider, &QSlider::valueChanged, this, &CardAmountWidget::adjustFontSize);
|
||||
adjustFontSize(cardSizeSlider->value());
|
||||
|
||||
// Resize after a little delay since, initially, the parent widget has no size.
|
||||
QTimer::singleShot(50, this, [this]() {
|
||||
QTimer::singleShot(10, this, [this]() {
|
||||
adjustFontSize(this->cardSizeSlider->value());
|
||||
incrementButton->setFixedSize(parentWidget()->size().width() / 3, parentWidget()->size().height() / 9);
|
||||
decrementButton->setFixedSize(parentWidget()->size().width() / 3, parentWidget()->size().height() / 9);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue