Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    How to process events during window drag/resize.

    General and Desktop
    2
    2
    1338
    Loading More Posts
    • 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.
    • K
      Kwabena last edited by

      I have async-data being sent to my application that needs to be processed by the GUI thread. My problem is that when a window is dragged or re-sized in my application the GUI thread is blocked until the event is finished. Is there any way to change the behavior so events are processed during window drags and resizes?

      I want to multi-thread the part of my application that is handling this async-data, but part of handling the data requires me to create new GUI objects and such. I can't do this in another thread. Since the GUI thread can be blocked indefinitely by window drag or resize I'm out of luck with this approach. Even if I queue up things for the GUI thread to do while resizing/dragging occurs, I'm afraid this could crash my application if the data is never processed by the GUI thread in a timely fashion.

      Does anyone know how to solve a problem like this? Should I just assume that the user will never drag/resize the application indefinitely that would cause a crash, and then multi-thread everything?

      1 Reply Last reply Reply Quote 0
      • B
        butterface last edited by

        That sounds like a bad design to me. Your UI should not depend on anything sent to you but your model should get updated. After your model is updated you can notify your UI that there is something new to display so this will never interfere with resizing or dragging because these events will occur one after the other.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post