diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index 76753287..19bfd744 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -10,6 +10,12 @@ 510 + + + 550 + 0 + + Web eID @@ -193,9 +199,6 @@ height: 24px; 30 - - QLayout::SetFixedSize - 20 @@ -232,12 +235,6 @@ height: 24px; - - - 510 - 0 - - Qt::TabFocus @@ -309,12 +306,6 @@ height: 24px; - - - 510 - 0 - - Qt::TabFocus @@ -450,12 +441,6 @@ height: 24px; - - - 510 - 0 - - Qt::TabFocus @@ -538,12 +523,6 @@ height: 24px; - - - 510 - 0 - - Qt::TabFocus @@ -794,12 +773,6 @@ height: 24px; - - - 510 - 0 - - 10 diff --git a/src/ui/webeiddialog.cpp b/src/ui/webeiddialog.cpp index 35950e15..f13ffe41 100644 --- a/src/ui/webeiddialog.cpp +++ b/src/ui/webeiddialog.cpp @@ -159,9 +159,7 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private) ui->fatalHelp->hide(); ui->selectAnotherCertificate->hide(); - connect(ui->pageStack, &QStackedWidget::currentChanged, this, [this] { - ui->pageStack->setFixedHeight(ui->pageStack->currentWidget()->sizeHint().height()); - }); + connect(ui->pageStack, &QStackedWidget::currentChanged, this, &WebEidDialog::resizeHeight); connect(ui->selectionGroup, qOverload(&QButtonGroup::buttonClicked), this, [this] { ui->okButton->setEnabled(true); @@ -245,12 +243,16 @@ void WebEidDialog::showAboutPage() if (app->isSafariExtensionContainingApp()) { d->setupOK([app] { app->showSafariSettings(); }, QT_TR_NOOP("Open Safari settings..."), true); - connect(app, &Application::safariExtensionEnabled, d->ui->aboutAlert, &QWidget::setHidden); + connect(app, &Application::safariExtensionEnabled, d, [d](bool value) { + d->ui->aboutAlert->setHidden(value); + d->resizeHeight(); + }); app->requestSafariExtensionState(); } else { d->ui->okButton->hide(); } d->ui->pageStack->setCurrentIndex(int(Page::ABOUT)); + d->resizeHeight(); d->open(); connect(d, &WebEidDialog::finished, qApp, &QApplication::quit); } @@ -267,6 +269,7 @@ void WebEidDialog::showFatalErrorPage() d->ui->cancelButton->show(); d->ui->okButton->hide(); d->ui->pageStack->setCurrentIndex(int(Page::ALERT)); + d->resizeHeight(); d->exec(); } @@ -454,6 +457,7 @@ void WebEidDialog::onVerifyPinFailed(const VerifyPinFailed::Status status, const break; case Status::PIN_BLOCKED: displayPinBlockedError(); + resizeHeight(); return; case Status::INVALID_PIN_LENGTH: message = [] { return tr("Invalid PIN length"); }; @@ -481,6 +485,7 @@ void WebEidDialog::onVerifyPinFailed(const VerifyPinFailed::Status status, const ui->pinTitleLabel->show(); ui->okButton->setDisabled(true); ui->cancelButton->setEnabled(true); + resizeHeight(); } } @@ -497,6 +502,7 @@ bool WebEidDialog::event(QEvent* event) case QEvent::LanguageChange: ui->retranslateUi(this); emit languageChange(); + resizeHeight(); break; case QEvent::MouseButtonRelease: if (auto* w = findChild(QStringLiteral("langMenu"))) { @@ -685,6 +691,12 @@ void WebEidDialog::showPinInputWarning(bool show) style()->polish(ui->pinInput); } +void WebEidDialog::resizeHeight() +{ + ui->pageStack->setFixedHeight(ui->pageStack->currentWidget()->sizeHint().height()); + adjustSize(); +} + QPixmap WebEidDialog::pixmap(QLatin1String name) { return {QStringLiteral(":/images/%1%2.svg") diff --git a/src/ui/webeiddialog.hpp b/src/ui/webeiddialog.hpp index 726558e8..cdbe2c0b 100644 --- a/src/ui/webeiddialog.hpp +++ b/src/ui/webeiddialog.hpp @@ -106,6 +106,7 @@ class WebEidDialog final : public WebEidUI void displayPinBlockedError(); void showPinInputWarning(bool show); + void resizeHeight(); static QPixmap pixmap(QLatin1String name); constexpr static std::tuple