Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. My QProgressDialog is being shown unintentionally
Forum Updated to NodeBB v4.3 + New Features

My QProgressDialog is being shown unintentionally

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 5 Posters 997 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jmguerra
    wrote on last edited by
    #1

    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 to QProgressDialog 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.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #8

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      J 1 Reply Last reply
      4
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi
        And it shows itself as a floating window?

        J 1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          And it shows itself as a floating window?

          J Offline
          J Offline
          jmguerra
          wrote on last edited by
          #3

          @mrjj yes 🤔

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #4

            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.

            J 1 Reply Last reply
            0
            • mrjjM mrjj

              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.

              J Offline
              J Offline
              jmguerra
              wrote on last edited by jmguerra
              #5

              @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.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                Derive from QProgressDialog, overwrite showEvent(), set a breakpoint there and see from where it is called.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                2
                • J Offline
                  J Offline
                  jmguerra
                  wrote on last edited by
                  #7

                  @Christian-Ehrlicher I inherited from QProgressDialog and set a breaking point at showEvent, 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 Unknown

                  It seems like forceShow() is being trigered by some random timer.

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    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.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    J 1 Reply Last reply
                    4
                    • Christian EhrlicherC Christian Ehrlicher

                      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.

                      J Offline
                      J Offline
                      jmguerra
                      wrote on last edited by
                      #9

                      @Christian-Ehrlicher I didn't think about that alternative, is it an appropriate practice to create widgets after start?

                      jsulmJ 1 Reply Last reply
                      0
                      • Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        @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.

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        1 Reply Last reply
                        1
                        • J jmguerra

                          @Christian-Ehrlicher I didn't think about that alternative, is it an appropriate practice to create widgets after start?

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #11
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            AMaryBell
                            wrote on last edited by
                            #12
                            This post is deleted!
                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved