diff --git a/src/Gui/ProgressBar.cpp b/src/Gui/ProgressBar.cpp index 69ac62bc9c..bf65b37e0b 100644 --- a/src/Gui/ProgressBar.cpp +++ b/src/Gui/ProgressBar.cpp @@ -34,7 +34,12 @@ # include #endif +#if QT_VERSION >= 0x050000 +# include +#endif + #include "ProgressBar.h" +#include "ProgressDialog.h" #include "MainWindow.h" #include "WaitCursor.h" @@ -62,10 +67,20 @@ struct ProgressBarPrivate bool isModalDialog(QObject* o) const { QWidget* parent = qobject_cast(o); +#if QT_VERSION >= 0x050000 + if (!parent) { + QWindow* window = qobject_cast(o); + if (window) + parent = QWidget::find(window->winId()); + } +#endif while (parent) { QMessageBox* dlg = qobject_cast(parent); if (dlg && dlg->isModal()) return true; + QProgressDialog* pd = qobject_cast(parent); + if (pd) + return true; parent = parent->parentWidget(); } @@ -584,7 +599,8 @@ bool ProgressBar::eventFilter(QObject* o, QEvent* e) case QEvent::NativeGesture: case QEvent::ContextMenu: { - return true; + if (!d->isModalDialog(o)) + return true; } break; // special case if the main window's close button was pressed @@ -601,10 +617,10 @@ bool ProgressBar::eventFilter(QObject* o, QEvent* e) // do a system beep and ignore the event case QEvent::MouseButtonPress: { - if (d->isModalDialog(o)) - return false; - QApplication::beep(); - return true; + if (!d->isModalDialog(o)) { + QApplication::beep(); + return true; + } } break; default: