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. Does Dragging Floating QWidgets Block Main GUI Thread?

Does Dragging Floating QWidgets Block Main GUI Thread?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 846 Views
  • 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.
  • P Offline
    P Offline
    polluxpolaris
    wrote on last edited by polluxpolaris
    #1

    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()

    jsulmJ 1 Reply Last reply
    0
    • P polluxpolaris

      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()

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply
      0
      • jsulmJ jsulm

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

        P Offline
        P Offline
        polluxpolaris
        wrote on last edited by
        #3

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

        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