Nominate our 2022 Qt Champions!

QMainWindow repaint freeze on titlebar mouse press

  • Hello!

    I have a background OpenGL rendering thread, which emits frameUpdated(QImage) signal 60 times per seconds.

    I have a QMainWindow class, which connects this signal with its onFrameUpdated(QImage) slot. In this slot i save a received QImage and call repaint().

    Everything is working good, but when i press on the titlebar of a QMainWindow, repainting is freezed (last QImage frame is stucked), until:

    1. i have released the button;
    2. i have moved the cursor;
    3. about 500ms are expired.

    After this all the stucked frames are painted very quickly and then repainting goes back to 60 FPS.

    So events are stucked, how can i fix this? There is a lot of members in QMainWindow and QWidget, i don't know, what can help.

    P.S.: sorry for my english.

  • Lifetime Qt Champion

    Your english is fine.
    When you grab a window by its caption, some OSes ( windows) will
    suspend all events to the window while being dragged.
    I think its what you are seeing.

  • @mrjj oh, ok, so i can't prevent this little freeze when i want to move the window on Windows. Thank you!

  • Lifetime Qt Champion

    Not really. its possible to use native API and intercept the movement and manually try to update but
    since drawing is also suspended, its not easy to work around. (as far as i know)

Log in to reply