Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

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

    General and Desktop
    4
    5
    2615
    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.
    • josephmalicke
      josephmalicke last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • Chris Kawa
          Chris Kawa Moderators last edited by 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 1 Reply Last reply Reply Quote 1
          • A
            alex_malyu @Chris Kawa last edited by

            @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 Reply Quote 0
            • Chris Kawa
              Chris Kawa Moderators last edited by

              @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 Reply Quote 0
              • First post
                Last post