Does Dragging Floating QWidgets Block Main GUI Thread?



  • While dragging floating QDockWidgets or QDialog around the screen, the main GUI thread seems to be blocked and possibly other threads as well. Is this expected behavior? Is there any way I can keep floating/dragging QWidgets from blocking other threads?

    Environment:
    Windows 7
    QT 5.4.1

    Test Case:

    1. I create a docked QDockWidget *textWidget with a QTextEdit that has text constantly written to it..
    2. I create a separate QDockWidget *floatWidget.
    3. At runtime I undock floatWidget and drag it around the screen without releasing the left mouse button.
    4. textWidget keeps updating with new text while floatWidget is being dragged.
    5. I release the left mouse button so floatWidget is floating.
    6. I click and drag floatWidget around the screen without releasing the left mouse button.
    7. textWidget stops updating while left mouse button is held down.
    8. I release the left mouse button and leave floatWidget floating.
    9. textWidget resumes text updates.

    It seems like once a QWidget starts floating, it will then block other threads while being dragged until it stops being dragged or is docked.
    Is there any way I can keep floating/dragging QWidgets from blocking other threads?

    I tried installEventFilter() to intercept all QDialog events in case some move event was flooding the thread.
    I tried setting QDialog parent as MainWindow as well as MainWindow->parentWidget().
    I tried placing QDialog in it's own QThread.
    I tried setMouseTracking(false).
    I tried all of the different setWindowsFlags()


  • Moderators

    @polluxpolaris One note: there is only one GUI thread where all widgets are living. Your problem is not related to multithreading. And you should never use GUI classes in non GUI thread! All GUI classes (widgets, dialogs,...) must be in the same thread.

    To your question: I assume it is expected behaviour, but I don't know for sure, maybe anybody else knows.



  • @jsulm You are correct. I updated my question to reference specifically the main gui thread. I've never used a GUI class in a non-GUI thread, I was just trying anything I could to see if I could keep the dragged QWidget from blocking the GUI thread.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.