Resize when expanding section

Took 4 minutes

Took 3 minutes

Took 7 minutes
This commit is contained in:
Lukas Brübach 2026-08-24 21:46:41 +02:00
parent 16f792d071
commit 08c37316ad
2 changed files with 20 additions and 0 deletions

View file

@ -12,6 +12,7 @@
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
#include <QSpinBox> #include <QSpinBox>
#include <QTimer>
#include <QUrl> #include <QUrl>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <libcockatrice/card/database/card_database_manager.h> #include <libcockatrice/card/database/card_database_manager.h>
@ -198,6 +199,22 @@ void CardDatabaseSetupPage::onToggleAdvanced(bool open)
advancedToggleButton->setText(open ? tr("▼ Advanced: custom download source") advancedToggleButton->setText(open ? tr("▼ Advanced: custom download source")
: tr("▶ Advanced: custom download source")); : tr("▶ Advanced: custom download source"));
advancedPanel->setVisible(open); advancedPanel->setVisible(open);
QWidget *wizardWindow = window();
if (!wizardWindow) {
return;
}
if (open) {
windowSizeBeforeExpansion = wizardWindow->size();
QTimer::singleShot(0, this, [wizardWindow] {
wizardWindow->resize(wizardWindow->size().expandedTo(wizardWindow->sizeHint()));
});
} else {
QTimer::singleShot(0, this, [this, wizardWindow] {
wizardWindow->resize(wizardWindow->size().boundedTo(windowSizeBeforeExpansion));
});
}
} }
void CardDatabaseSetupPage::onApplyCustomUrl() void CardDatabaseSetupPage::onApplyCustomUrl()

View file

@ -3,6 +3,8 @@
#include "../first_run_wizard_page.h" #include "../first_run_wizard_page.h"
#include <QSize>
class QComboBox; class QComboBox;
class QLabel; class QLabel;
class QLineEdit; class QLineEdit;
@ -71,6 +73,7 @@ private:
QSpinBox *checkIntervalSpinBox; QSpinBox *checkIntervalSpinBox;
State state = State::NotStarted; State state = State::NotStarted;
QSize windowSizeBeforeExpansion;
}; };
#endif // CARD_DATABASE_SETUP_PAGE_H #endif // CARD_DATABASE_SETUP_PAGE_H