Add ready widget into widget
-
Hello I am working on a project. in this project there will be menus on the left side and when clicked, the content of that menu will open on the right side. but I have no idea how it should be done. I am leaving an example
when device is selected there is something else on the right hand side and when text editor is selected there is something else on the right hand side. how does this happen? what is added there?
Is it Qt designer form class (.cpp && .h && .ui)? -
@Joe-von-Habsburg said in Add ready widget into widget:
I am leaving an example
QtCreator Preferences is your example?!
So you want something similar?!You could dig into QtCreator source code and check out how it's done.
For this I would useQToolButton
to populate the "menu bar" on the left and aQStackedWidget
to display the content pages on the right. Actually theQStackedWidget
is more like centered, as the whole window you see is divided into two sections (~15% / ~85%) for the menu and the "rest" (theQStackedWidget
for the content).Is it Qt designer form class (.cpp && .h && .ui)?
The "right side" is the content widget... In case of QtCreator a custom
QWidget
containing aQTabWidget
for the Text Editor settings among many other things.
The parent of all this is probably aQStackedWidget
as I presumed above.What approach (with or without Designer Form) you pick to implement this has nothing to do with how it works.
Both ways are possible. -