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. The widgets in one QTabWidget tab gets offset from the widgets in the other tab
QtWS25 Last Chance

The widgets in one QTabWidget tab gets offset from the widgets in the other tab

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 349 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.
  • C Offline
    C Offline
    Cynical
    wrote on last edited by Cynical
    #1

    I am attempting to make a panel where information is shown and able to be edited. I do this by having a QTabWidget with two tabs: one for displaying and one for editing. I would like the widgets in the edit tab to line up nicely with the widgets in the display tab.

    Here is a GIF showing me switching between the two tabs in QT Designer:

    https://i.imgur.com/27IUn2X.gifv

    As you can see, they line up nicely enough. However, as you can see in this GIF showing me switching between the two tabs in the compiled program, something causes the widgets in the edit tab to move up and slightly to the left:

    https://i.imgur.com/9r7T4xN.gifv

    The layout items on the bottom half seem to have a lot more room than the layout items on the bottom half.

    No spacers or layouts should have different values between the two tabs, on top of which it seems the QT Creator is doing something differently to the compiled program. I really have no idea what could be causing this.

    Any help in solving this issue or getting me on track to a better solution for having widgets overlayed in a manner described in the first paragraph would be much appreciated.

    Thank you!

    EDIT:

    I still don't know what caused the bug, but if anyone else is reading this, having run into a similar issue: I "fixed" it by remaking the whole thing step by step, trying to figure out which step of the caused the bug. During my remaking of the panel I figured a QStackedWidget worked better for what I was trying to achieve and so I went with that instead. It currently runs fine with no trace of the issue plaguing the QTabWidget.

    I recommend remaking it step by step for further debugging.

    Pl45m4P 1 Reply Last reply
    0
    • C Cynical

      I am attempting to make a panel where information is shown and able to be edited. I do this by having a QTabWidget with two tabs: one for displaying and one for editing. I would like the widgets in the edit tab to line up nicely with the widgets in the display tab.

      Here is a GIF showing me switching between the two tabs in QT Designer:

      https://i.imgur.com/27IUn2X.gifv

      As you can see, they line up nicely enough. However, as you can see in this GIF showing me switching between the two tabs in the compiled program, something causes the widgets in the edit tab to move up and slightly to the left:

      https://i.imgur.com/9r7T4xN.gifv

      The layout items on the bottom half seem to have a lot more room than the layout items on the bottom half.

      No spacers or layouts should have different values between the two tabs, on top of which it seems the QT Creator is doing something differently to the compiled program. I really have no idea what could be causing this.

      Any help in solving this issue or getting me on track to a better solution for having widgets overlayed in a manner described in the first paragraph would be much appreciated.

      Thank you!

      EDIT:

      I still don't know what caused the bug, but if anyone else is reading this, having run into a similar issue: I "fixed" it by remaking the whole thing step by step, trying to figure out which step of the caused the bug. During my remaking of the panel I figured a QStackedWidget worked better for what I was trying to achieve and so I went with that instead. It currently runs fine with no trace of the issue plaguing the QTabWidget.

      I recommend remaking it step by step for further debugging.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @Cynical

      Can you show the layouts of both widgets? IMO it's the 3rd button inside the editTab, which is causing the rest to move up.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Cynical
        wrote on last edited by
        #3

        That could be the case.

        Here's the display tab:
        UI: https://i.imgur.com/rM7BQ6L.png
        Tree: https://i.imgur.com/58ieTST.png
        Button Layout Settings: https://i.imgur.com/lw4APWZ.png
        Button Settings: https://i.imgur.com/xvlT4iE.png

        ...and the edit tab:
        UI: https://i.imgur.com/GorC22b.png
        Tree: https://i.imgur.com/TOp5v5M.png
        Button Layout Settings: https://i.imgur.com/tF0XO1P.png
        Button Settings: https://i.imgur.com/oQRQ0sL.png
        Button Spacer Settings: https://i.imgur.com/CjVTl5G.png

        Thank you!

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          did you set the layout for the widget itself? it doesn't appear like it from the designer gif. Click on the background and then layout vertically

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Cynical
            wrote on last edited by
            #5

            I did, yeah. Everything should be in a layout

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Cynical
              wrote on last edited by
              #6
              This post is deleted!
              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