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 can I get the location of a QDockWidget in its current dock area?
QtWS25 Last Chance

How can I get the location of a QDockWidget in its current dock area?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 3.1k 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.
  • josephmalickeJ Offline
    josephmalickeJ Offline
    josephmalicke
    wrote on last edited by
    #1

    How can I get the location of a QDockWidget in its current dock area? For example, if I have a dock area split in half with two widgets, how can I query the framework to find out which one is on top and which one is on bottom? The user can, of course, be dragging and dropping QDockWidgets dynamically.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You can use geometry for that.

      Hope it helps

      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
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by Chris Kawa
        #3

        I consider the docking system to be one of the weakest points of Qt widgets. It's quite limited when it comes to querying for the state/position of the docks. It only provides basic information like dock area of the dock and partial tabbing information. Not enough to actually record/restore the dock position reliably.

        Take a look at this example:
        Docks example

        There's no way to completely tell what is the relation between dock A and other docks. There's no (direct at least) API to tell what the order of tabbed items is and how to recreate. You could look for a QTabWidget parent in A but that's really relying on internal implementation.
        You also can't really use geometry of the docks because thet doesn't tell you the order they were split in. For example dock F could be split vertically with C and D or horizontally with E. No way to tell in the API :(
        On top of that there are quite a few bugs related to correct reporting of various state when floating docks and GroupedDragging flag are involved.
        All in all I'd steer away from trying to figure out the relation between docks if you can help it. It's unreliable at best and doable (to some degree) only if you put restrictions on the docks e.g. no nested or floating docks.

        A 1 Reply Last reply
        1
        • Chris KawaC Chris Kawa

          I consider the docking system to be one of the weakest points of Qt widgets. It's quite limited when it comes to querying for the state/position of the docks. It only provides basic information like dock area of the dock and partial tabbing information. Not enough to actually record/restore the dock position reliably.

          Take a look at this example:
          Docks example

          There's no way to completely tell what is the relation between dock A and other docks. There's no (direct at least) API to tell what the order of tabbed items is and how to recreate. You could look for a QTabWidget parent in A but that's really relying on internal implementation.
          You also can't really use geometry of the docks because thet doesn't tell you the order they were split in. For example dock F could be split vertically with C and D or horizontally with E. No way to tell in the API :(
          On top of that there are quite a few bugs related to correct reporting of various state when floating docks and GroupedDragging flag are involved.
          All in all I'd steer away from trying to figure out the relation between docks if you can help it. It's unreliable at best and doable (to some degree) only if you put restrictions on the docks e.g. no nested or floating docks.

          A Offline
          A Offline
          alex_malyu
          wrote on last edited by
          #4

          @Chris-Kawa

          I completely agree with your comment. What is sad it is in the same state for years.
          Any plans on improvement?

          1 Reply Last reply
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @alex_malyu said:

            Any plans on improvement?

            Widgets are not that actively developed these days, though there are some improvements in Qt 5.6. Unfortunately the pace is slow. A lot of very useful features are still missing and the new ones are quite buggy.

            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