From 6f53d0e9d0b4da7b80c74d0bf73d4f7299b5a22e Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 12 May 2019 17:26:21 +0200 Subject: [PATCH] hide taskbar progress when required --- src/Gui/ProgressBar.cpp | 25 +++++++++++++++++-------- src/Gui/ProgressBar.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Gui/ProgressBar.cpp b/src/Gui/ProgressBar.cpp index ece05ef9e9..f1246013c9 100644 --- a/src/Gui/ProgressBar.cpp +++ b/src/Gui/ProgressBar.cpp @@ -264,7 +264,7 @@ void Sequencer::resetData() QThread *thr = d->bar->thread(); // this is the main thread if (thr != currentThread) { QMetaObject::invokeMethod(d->bar, "reset", Qt::QueuedConnection); - QMetaObject::invokeMethod(d->bar, "hide", Qt::QueuedConnection); + QMetaObject::invokeMethod(d->bar, "aboutToHide", Qt::QueuedConnection); QMetaObject::invokeMethod(getMainWindow()->statusBar(), "showMessage", Qt::/*Blocking*/QueuedConnection, QGenericReturnArgument(), @@ -280,7 +280,7 @@ void Sequencer::resetData() // Note: Under Qt 4.1.4 this forces to run QWindowsStyle::eventFilter() twice // handling the same event thus a warning is printed. Possibly, this is a bug // in Qt. The message is QEventDispatcherUNIX::unregisterTimer: invalid argument. - d->bar->hide(); + d->bar->aboutToHide(); delete d->waitCursor; d->waitCursor = 0; d->bar->leaveControlEvents(); @@ -426,12 +426,26 @@ void ProgressBar::aboutToShow() { // delay showing the bar d->delayShowTimer->start(d->minimumDuration); +#ifdef QT_WINEXTRAS_LIB + setupTaskBarProgress(); + m_taskbarProgress->show(); +#endif } void ProgressBar::delayedShow() { - if (!isVisible() && !sequencer->wasCanceled() && sequencer->isRunning()) + if (!isVisible() && !sequencer->wasCanceled() && sequencer->isRunning()) { show(); + } +} + +void ProgressBar::aboutToHide() +{ + hide(); +#ifdef QT_WINEXTRAS_LIB + setupTaskBarProgress(); + m_taskbarProgress->hide(); +#endif } bool ProgressBar::canAbort() const @@ -453,10 +467,6 @@ void ProgressBar::hideEvent(QHideEvent* e) { QProgressBar::hideEvent(e); d->delayShowTimer->stop(); -#ifdef QT_WINEXTRAS_LIB - setupTaskBarProgress(); - m_taskbarProgress->hide(); -#endif } void ProgressBar::resetObserveEventFilter() @@ -491,7 +501,6 @@ void ProgressBar::setupTaskBarProgress() //m_myButton->setOverlayIcon(QIcon("")); m_taskbarProgress = m_taskbarButton->progress(); - m_taskbarProgress->setVisible(true); } } #endif diff --git a/src/Gui/ProgressBar.h b/src/Gui/ProgressBar.h index ff2adea473..58eca20a0b 100644 --- a/src/Gui/ProgressBar.h +++ b/src/Gui/ProgressBar.h @@ -180,6 +180,7 @@ protected Q_SLOTS: */ void delayedShow(); void aboutToShow(); + void aboutToHide(); private: /** @name for internal use only */