How does the UI have different user display modes
-
Hi, all
I want to design some UIs for different users. Here is a simple example that can be switched by hiding some widgets. But there are also some relatively more complex UIs, which must be re-layout to achieve good results. I read some docs of qstackedwidget/qstacklayout, they are suitable for multiple pages, my UI is actually just one page.
My idea is to create 2 layouts: normalLayout and superLayout, when the toggle button is clicked:
for super mode:
(1) clear normalLayout
(2) re-layout superLayout
(3) this->setLayout(superLayout)
for normal mode:
(1) clear superLayout
(2) re-layout normalLayout
(3) this->setLayout(normalLayout)
I don’t know if this is too complicated. Could you give me some suggestions please?
Best regards!Normal mode:

Super mode:

-
Hi, all
I want to design some UIs for different users. Here is a simple example that can be switched by hiding some widgets. But there are also some relatively more complex UIs, which must be re-layout to achieve good results. I read some docs of qstackedwidget/qstacklayout, they are suitable for multiple pages, my UI is actually just one page.
My idea is to create 2 layouts: normalLayout and superLayout, when the toggle button is clicked:
for super mode:
(1) clear normalLayout
(2) re-layout superLayout
(3) this->setLayout(superLayout)
for normal mode:
(1) clear superLayout
(2) re-layout normalLayout
(3) this->setLayout(normalLayout)
I don’t know if this is too complicated. Could you give me some suggestions please?
Best regards!Normal mode:

Super mode:

@tovax this sounds like a case for object inheritance
make a base class with the normal mode,
make a supermode class, that has the normal mode as base, and extend that.
You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind
-
@tovax this sounds like a case for object inheritance
make a base class with the normal mode,
make a supermode class, that has the normal mode as base, and extend that.
You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind
@J-Hilk Hi, thank you very much for your answer! According to your advice on inheritance, I wrote NormalModeClass, which is inherited by SuperModeClass.
You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind. This sentence is very useful to me, thanks again. -
@tovax this sounds like a case for object inheritance
make a base class with the normal mode,
make a supermode class, that has the normal mode as base, and extend that.
You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind
-
@tovax you fetch the layout from the base class, you may want to add a function for that, and add your child layout to the original one, as additional components,
would my idea be