Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
The widgets in one QTabWidget tab gets offset from the widgets in the other tab
Cynical last edited by 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:
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:
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.
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.
Pl45m4 last edited by
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.
That could be the case.
Here's the display tab:
Button Layout Settings: https://i.imgur.com/lw4APWZ.png
Button Settings: https://i.imgur.com/xvlT4iE.png
...and the edit tab:
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
VRonin last edited by
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
I did, yeah. Everything should be in a layout
This post is deleted!