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. how to immediately show / update a window without returning to event loop?
Qt 6.11 is out! See what's new in the release blog

how to immediately show / update a window without returning to event loop?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 2.9k Views 4 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.
  • davecotterD Offline
    davecotterD Offline
    davecotter
    wrote on last edited by
    #1

    on windows, the moment i call this:

    i_qWindP->show();
    

    the window shows. on mac it doesn't show. is there some "idle" call i can make to allow the OS some CPU time to get the window on screen?

    then, say i update a control in that window (like, a progress bar), how do i get that to flush immediately? this is during startup so we're not at the event loop just yet...

    Kent-DorfmanK 1 Reply Last reply
    0
    • davecotterD Offline
      davecotterD Offline
      davecotter
      wrote on last edited by
      #7

      Okay it seems the secret was calling QApplication::processEvents();

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mpergand
        wrote on last edited by
        #2

        To update a widget immediately, call repaint() on that widget.

        1 Reply Last reply
        0
        • davecotterD Offline
          davecotterD Offline
          davecotter
          wrote on last edited by
          #3

          okay i'm calling repaint() on the QWindow widget but it doesn't actually draw when i step over that call, do i need to somehow yield some time to the event handler for that to actually be serviced?

          SGaistS 1 Reply Last reply
          0
          • davecotterD Offline
            davecotterD Offline
            davecotter
            wrote on last edited by
            #4

            also, on the mac, the window isn't even being shown. i call show and i get nothing.

            1 Reply Last reply
            0
            • davecotterD davecotter

              on windows, the moment i call this:

              i_qWindP->show();
              

              the window shows. on mac it doesn't show. is there some "idle" call i can make to allow the OS some CPU time to get the window on screen?

              then, say i update a control in that window (like, a progress bar), how do i get that to flush immediately? this is during startup so we're not at the event loop just yet...

              Kent-DorfmanK Offline
              Kent-DorfmanK Offline
              Kent-Dorfman
              wrote on last edited by Kent-Dorfman
              #5
              This post is deleted!
              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                Hi,

                What do you do in that QWindow ?

                Since it's a QWindow, you are likely doing OpenGL therefore, did you initialise everything properly ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                davecotterD 1 Reply Last reply
                0
                • davecotterD Offline
                  davecotterD Offline
                  davecotter
                  wrote on last edited by
                  #7

                  Okay it seems the secret was calling QApplication::processEvents();

                  1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Hi,

                    What do you do in that QWindow ?

                    Since it's a QWindow, you are likely doing OpenGL therefore, did you initialise everything properly ?

                    davecotterD Offline
                    davecotterD Offline
                    davecotter
                    wrote on last edited by
                    #8

                    @SGaist no it's just a regular dialog window

                    1 Reply Last reply
                    0
                    • davecotterD davecotter

                      okay i'm calling repaint() on the QWindow widget but it doesn't actually draw when i step over that call, do i need to somehow yield some time to the event handler for that to actually be serviced?

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      @davecotter said in how to immediately show / update a window without returning to event loop?:

                      okay i'm calling repaint() on the QWindow widget but it doesn't actually draw when i step over that call, do i need to somehow yield some time to the event handler for that to actually be serviced?

                      That QWindow was then misleading ;-)

                      As for your solution, you are in fact forcing a round of the event loop.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1

                      • Login

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