Important: Please read the Qt Code of Conduct -

How can I find a QWidget that pops up and goes away very quickly?

  • In some part of my code (which is quite big) some kind of QWidget or QDialog is being created and shown floating on screen but it very quickly goes away and I cannot find where it comes from. in the code

    I have tried attaching a gdb debugger and setting breakpoints in different places:
    QDialog::QDialog(), QDialog::showEvent()
    QWidget::QWidget(), QWidget::showEvent()
    QWidget::repaint, etc...

    but I cannot find the exact place in my code where this widget is being created. It must be somewhere where a widget is created without parent. What can I do to find it ? Is it possible to instrument Qt to stop when a widget is being shown on screen?


  • Moderators

    install an eventfilter on your qApp instance and set a breakpoint for objects/widgets which get a ShowEvent and inspect the callstack.
    Depending on your code this might already give a close clue to where it comes from.

  • Check the places where timers may be used

Log in to reply