mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-09 16:35:13 +00:00
Qt: properly hide and show progress indicator
This was previously always shown, since we never really re-used the progress dialogs.
This commit is contained in:
parent
281f248d91
commit
5745862fa8
4 changed files with 43 additions and 10 deletions
|
|
@ -16,17 +16,7 @@ progress_dialog::progress_dialog(const QString& windowTitle, const QString& labe
|
|||
SetDeleteOnClose();
|
||||
}
|
||||
|
||||
// Try to find a window handle first
|
||||
QWindow* handle = windowHandle();
|
||||
|
||||
for (QWidget* ancestor = this; !handle && ancestor;)
|
||||
{
|
||||
ancestor = static_cast<QWidget*>(ancestor->parent());
|
||||
if (ancestor) handle = ancestor->windowHandle();
|
||||
}
|
||||
|
||||
m_progress_indicator = std::make_unique<progress_indicator>(minimum, maximum);
|
||||
m_progress_indicator->show(handle);
|
||||
}
|
||||
|
||||
progress_dialog::~progress_dialog()
|
||||
|
|
@ -61,3 +51,34 @@ void progress_dialog::SignalFailure() const
|
|||
|
||||
QApplication::beep();
|
||||
}
|
||||
|
||||
void progress_dialog::show_progress_indicator()
|
||||
{
|
||||
// Try to find a window handle first
|
||||
QWindow* handle = windowHandle();
|
||||
|
||||
for (QWidget* ancestor = this; !handle && ancestor;)
|
||||
{
|
||||
ancestor = static_cast<QWidget*>(ancestor->parent());
|
||||
if (ancestor) handle = ancestor->windowHandle();
|
||||
}
|
||||
|
||||
m_progress_indicator->show(handle);
|
||||
}
|
||||
|
||||
void progress_dialog::setVisible(bool visible)
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
if (!isVisible())
|
||||
{
|
||||
show_progress_indicator();
|
||||
}
|
||||
}
|
||||
else if (isVisible())
|
||||
{
|
||||
m_progress_indicator->hide();
|
||||
}
|
||||
|
||||
QProgressDialog::setVisible(visible);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue