Qt: Disable close for non-cancellable progress dialog

This commit is contained in:
Stenzek 2024-11-16 12:59:53 +10:00
parent 49b669c8be
commit 61dae0ed6f
No known key found for this signature in database
1 changed files with 2 additions and 0 deletions

View File

@ -19,6 +19,7 @@ QtModalProgressCallback::QtModalProgressCallback(QWidget* parent_widget, float s
m_dialog.setModal(parent_widget != nullptr);
m_dialog.setAutoClose(false);
m_dialog.setAutoReset(false);
m_dialog.setWindowFlag(Qt::WindowCloseButtonHint, false);
connect(&m_dialog, &QProgressDialog::canceled, this, &QtModalProgressCallback::dialogCancelled);
checkForDelayedShow();
}
@ -31,6 +32,7 @@ void QtModalProgressCallback::SetCancellable(bool cancellable)
return;
ProgressCallback::SetCancellable(cancellable);
m_dialog.setWindowFlag(Qt::WindowCloseButtonHint, cancellable);
m_dialog.setCancelButtonText(cancellable ? tr("Cancel") : QString());
}