My QProgressDialog is being shown unintentionally
-
After updating to Qt5.14 (c++), all my
QProgressDialog
are being shown at the start of the program, as if there was a signal being emitted to show all of them. Even if I set the default state to hidden (myDialog->setHidden(true)
), they still come up. It only happens toQProgressDialog
objects and not for other widgets.Does someone know where could this unwanted behaviour come from?
m_exportDialog = new QProgressDialog(parent); m_exportDialog->setWindowModality(Qt::NonModal); m_exportDialog->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::CustomizeWindowHint ); m_exportDialog->setLabelText(tr("Exporting data to USB drive...")); m_exportDialog->setCancelButton(nullptr); m_exportDialog->setRange(0, 0); m_exportDialog->setMinimumDuration(0); m_exportDialog->setFixedSize(600, 120); m_exportDialog->setHidden(true);
After that, no
m_exportDialog->show()
is being called, but the dialog still comes up. -
Ah, that's coming from the fact that a QProgressDialog is only shown when the duration is long enough to avoid flicker. Therefore a showTimer is started which now kills you.
Then the easiest way is to create the dialog really only when you need it instead during program start. -
Hi
And it shows itself as a floating window? -
Hi
So when shown, you can move it around ?
I was for a moment wondering if it got embedded but
it should be clear if its floating or inside other form. -
@mrjj
Yes! I can move them (several progressDialogs) around. (Sorry for deleting the reply, I thought it was duplicated).I can also force
m_exportDialog->hide()
after the program is initialized, but I think that's just a hack and not a solution because I see them while my app is launching. -
Derive from QProgressDialog, overwrite showEvent(), set a breakpoint there and see from where it is called.
-
@Christian-Ehrlicher I inherited from
QProgressDialog
and set a breaking point atshowEvent
, it stops after the following call stack:GammaBot.exe!se::TestDialog::showEvent(QShowEvent * __formal) Line 48 C++
Qt5Widgetsd.dll!QWidget::event() + 3796 bytes Unknown
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper() + 415 bytes Unknown
Qt5Widgetsd.dll!00007ffed0f602a8() Unknown
common.dll!se::LoggingApplication::notify(QObject * receiver, QEvent * event) Line 18 C++
Qt5Cored.dll!QCoreApplication::notifyInternal2() + 288 bytes Unknown
Qt5Cored.dll!QCoreApplication::sendEvent() + 66 bytes Unknown
Qt5Widgetsd.dll!QWidgetPrivate::show_helper() + 501 bytes Unknown
Qt5Widgetsd.dll!QWidgetPrivate::setVisible() + 881 bytes Unknown
Qt5Widgetsd.dll!QWidget::setVisible() + 136 bytes Unknown
Qt5Widgetsd.dll!QDialog::setVisible() + 393 bytes Unknown
Qt5Widgetsd.dll!QWidget::show() + 139 bytes Unknown
Qt5Widgetsd.dll!QProgressDialog::forceShow() + 86 bytes Unknown
Qt5Widgetsd.dll!QProgressDialog::qt_static_metacall() + 431 bytes Unknown
Qt5Cored.dll!00007ffecf7255a3() Unknown
Qt5Cored.dll!QMetaObject::activate() + 103 bytes Unknown
Qt5Cored.dll!QTimer::timeout() + 62 bytes Unknown
Qt5Cored.dll!QTimer::timerEvent() + 74 bytes Unknown
Qt5Cored.dll!QObject::event() + 147 bytes Unknown
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper() + 415 bytes Unknown
Qt5Widgetsd.dll!QApplication::notify() + 1751 bytes Unknown
common.dll!se::LoggingApplication::notify(QObject * receiver, QEvent * event) Line 18 C++
Qt5Cored.dll!QCoreApplication::notifyInternal2() + 288 bytes Unknown
Qt5Cored.dll!QCoreApplication::sendEvent() + 66 bytes Unknown
Qt5Cored.dll!QEventDispatcherWin32Private::sendTimerEvent() + 148 bytes Unknown
Qt5Cored.dll!00007ffecf7847cb() Unknown
user32.dll!CallWindowProcW() + 1217 bytes Unknown
user32.dll!DispatchMessageW() + 467 bytes Unknown
Qt5Cored.dll!QEventDispatcherWin32::processEvents() + 1439 bytes Unknown
qwindowsd.dll!00007ffecb936784() Unknown
Qt5Cored.dll!QEventLoop::processEvents() + 109 bytes Unknown
Qt5Cored.dll!QEventLoop::exec() + 415 bytes Unknown
Qt5Cored.dll!QCoreApplication::exec() + 362 bytes Unknown
Qt5Guid.dll!QGuiApplication::exec() + 24 bytes Unknown
Qt5Widgetsd.dll!QApplication::exec() + 10 bytes UnknownIt seems like
forceShow()
is being trigered by some random timer. -
Ah, that's coming from the fact that a QProgressDialog is only shown when the duration is long enough to avoid flicker. Therefore a showTimer is started which now kills you.
Then the easiest way is to create the dialog really only when you need it instead during program start. -
@Christian-Ehrlicher I didn't think about that alternative, is it an appropriate practice to create widgets after start?
-
@jmguerra said in My QProgressDialog is being shown unintentionally:
is it an appropriate practice to create widgets after start?
No, I don't see why someone would first create all widgets during start. It just takes time for no good reason.