Skip to content

Commit

Permalink
Qt: Fix non-cancellable progress dialog height
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Nov 16, 2024
1 parent 61dae0e commit 854a8eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/duckstation-qt/qtprogresscallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
}

Expand Down
4 changes: 4 additions & 0 deletions src/duckstation-qt/qtprogresscallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 854a8eb

Please sign in to comment.