Working on multiple screen issue
-
wrote on 3 Feb 2020, 05:02 last edited by
Hello All,
My problem is similar to the given issue.
https://forum.qt.io/topic/56168/how-to-handle-multiple-screens-on-the-gui/4
Currently, I am using stacked widgets, but I need to switch within the screen.
There is a solution mentioned in the forum, is there an example referring the same
or is there any other alternative solution since it was discussed long back. -
Lifetime Qt Championwrote on 3 Feb 2020, 08:11 last edited by mrjj 2 Mar 2020, 08:12
Hi
The stacked widget approach is still the one to use for any design using a concept of "pages"For wizard like design, there is also
https://doc.qt.io/qt-5/qwizard.htmlSo what is the actual issue you have?
-
Hi
The stacked widget approach is still the one to use for any design using a concept of "pages"For wizard like design, there is also
https://doc.qt.io/qt-5/qwizard.htmlSo what is the actual issue you have?
wrote on 3 Feb 2020, 08:21 last edited by@mrjj: Thanks for the reply.
Currently, I have a main window with a stack widget.
I have inserted five widgets, ie. 5 pages of stacked widgets.
Each widget has its own independent functionality.
Now suppose there is a push button on page1 using which I have to call page4
How this is possible?
For example, the child widget won't have an idea about the parent widget. -
@mrjj: Thanks for the reply.
Currently, I have a main window with a stack widget.
I have inserted five widgets, ie. 5 pages of stacked widgets.
Each widget has its own independent functionality.
Now suppose there is a push button on page1 using which I have to call page4
How this is possible?
For example, the child widget won't have an idea about the parent widget.Lifetime Qt Championwrote on 3 Feb 2020, 08:43 last edited by jsulm 2 Mar 2020, 08:44@Kira said in Working on multiple screen issue:
How this is possible?
Connect the signal to a slot in the container widget (I guess MainWindow?) where you activate the page 4?
-
@Kira said in Working on multiple screen issue:
How this is possible?
Connect the signal to a slot in the container widget (I guess MainWindow?) where you activate the page 4?
wrote on 3 Feb 2020, 08:54 last edited by@jsulm: Ok thanks understood.
I was referring to one of the comments mentioned by the moderator in the given link:
https://forum.qt.io/topic/56168/how-to-handle-multiple-screens-on-the-gui/4
"I would give it a generic addScreen(Screen) function and then load them at runtime. This way you would design main window and each screen separately in the designer keeping them nice and separate*."
Any comments on that :) -
@jsulm: Ok thanks understood.
I was referring to one of the comments mentioned by the moderator in the given link:
https://forum.qt.io/topic/56168/how-to-handle-multiple-screens-on-the-gui/4
"I would give it a generic addScreen(Screen) function and then load them at runtime. This way you would design main window and each screen separately in the designer keeping them nice and separate*."
Any comments on that :)@Kira That post refers to creating the widgets dynamically if I understand it correctly
I'm still not sure about your exact use case: do you create the "screen" dynamically? -
Lifetime Qt Championwrote on 3 Feb 2020, 09:08 last edited by mrjj 2 Mar 2020, 09:09
Hi
I think the other tread just talk about using full UI enabled widgets with .cpp and .h
Just like MainWindow is. based on QWidget instead. ( as base class)That allows you to handle all functionality inside its .cpp file and not stuff all logic from pages into the mainwindow.
So to allow such self-contained Widgets to change page you need to define some new signals pr page it can emit and then
mainwin can do the page flipping. Or a small controller object if you wish to keep it really clean. -
Hi
I think the other tread just talk about using full UI enabled widgets with .cpp and .h
Just like MainWindow is. based on QWidget instead. ( as base class)That allows you to handle all functionality inside its .cpp file and not stuff all logic from pages into the mainwindow.
So to allow such self-contained Widgets to change page you need to define some new signals pr page it can emit and then
mainwin can do the page flipping. Or a small controller object if you wish to keep it really clean. -
Ok so thats why he talks about addScreen(Screen) as if we use a custom Widget as the page then
we need to use promotion or insert via code.If you need to be able to jump to random pages, from a page, i will recommend you use a tag name instead of the raw int index
as then inserting or remove pages later will not break the jumping. -
Ok so thats why he talks about addScreen(Screen) as if we use a custom Widget as the page then
we need to use promotion or insert via code.If you need to be able to jump to random pages, from a page, i will recommend you use a tag name instead of the raw int index
as then inserting or remove pages later will not break the jumping. -
Lifetime Qt Championwrote on 3 Feb 2020, 09:22 last edited by mrjj 2 Mar 2020, 09:23
Well i mean - use a name instead of the raw index.
like
emit GotoPage( "EditPage" )
versus
emit GotoPage( 6 )if you would ever change the flow or add new pages in the middle its nice
not to have to change all the index around the interface.I used a dynamic property for this. you can also use Widget objectname
-
Well i mean - use a name instead of the raw index.
like
emit GotoPage( "EditPage" )
versus
emit GotoPage( 6 )if you would ever change the flow or add new pages in the middle its nice
not to have to change all the index around the interface.I used a dynamic property for this. you can also use Widget objectname
1/12