Unsolved auto resizing stackedwidget and children
-
I'm using the qt designer with a QMainWindow and in that a QWidget contained a QStackedWidget so my program can have several different widgets. The problem I'm having is getting things to resize with the QMainWindow, it seems anything inside the QStackedWidget doesn't resize with the window, how can I fix this?
-
Hi,
Did you put that QStackedWidget as your QMainWindow central widget ?
-
@SGaist no the hierarchy is MainWindow->centralWidget->stackedWidget
-
In that case, either replace the central widget with the QStackedWidget, or put a layout on the central widget and the QStackedWidget in that layout.
-
@SGaist putting a layout on both does allow resizing but I'm unable to place things where I wan't them, they just lock to a certain position and If i try move them they just go back to that position
-
You can build complex layouts to do what you want.
If you really want to manage all by hand then you have to also re-implement the resize event of your "container" widgets to update the size and postions of their children.
-
@SGaist any suggestions where to learn this?
-
Do you mean learn the use of layouts ?
-
@SGaist learn how to make the complex layouts, because as far as I'm aware I've looked over the documentation and I still can't create a custom layout how I wan't. I just need pages that when the user resizes so does every child widget on that page, but I also wan't to be able to place the widgets where I wan't
-
Can you show an example of such a widget ?
-
@SGaist
This is what i have, need to add stuff like buttons and qlineedits to the login page to get user inputs. Need them to resize when the user resizes the window -
Hi
With GridLayout, you can resize the widgets by dragging the handles while in layout
However, as name suggest its a grid so there needs to be some alignment.