Qt: Fix non-cancellable progress dialog height

This commit is contained in:
Stenzek 2024-11-16 13:00:35 +10:00
parent 61dae0ed6f
commit 854a8eb1bb
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,7 @@ QtModalProgressCallback::QtModalProgressCallback(QWidget* parent_widget, float s
: QObject(parent_widget), m_dialog(QString(), QString(), 0, 1, parent_widget), m_show_delay(show_delay)
{
m_dialog.setWindowTitle(tr("DuckStation"));
m_dialog.setMinimumSize(QSize(500, 100));
m_dialog.setMinimumSize(MINIMUM_WIDTH, MINIMUM_HEIGHT_WITHOUT_CANCEL);
m_dialog.setModal(parent_widget != nullptr);
m_dialog.setAutoClose(false);
m_dialog.setAutoReset(false);
@ -33,6 +33,7 @@ void QtModalProgressCallback::SetCancellable(bool cancellable)
ProgressCallback::SetCancellable(cancellable);
m_dialog.setWindowFlag(Qt::WindowCloseButtonHint, cancellable);
m_dialog.setMinimumHeight(cancellable ? MINIMUM_HEIGHT_WITH_CANCEL : MINIMUM_HEIGHT_WITHOUT_CANCEL);
m_dialog.setCancelButtonText(cancellable ? tr("Cancel") : QString());
}

View File

@ -35,6 +35,10 @@ private Q_SLOTS:
void dialogCancelled();
private:
static constexpr int MINIMUM_WIDTH = 500;
static constexpr int MINIMUM_HEIGHT_WITHOUT_CANCEL = 70;
static constexpr int MINIMUM_HEIGHT_WITH_CANCEL = 100;
void checkForDelayedShow();
QProgressDialog m_dialog;