stackedwidget for different class which they have their own .cpp , .h, and .ui
-
@mrjj I did put a widget on the stackedWidget. Even though it is a QDialog, I created a widget inside of it. I was able to call the files and add them into the stackwidget. My question now is how do I call a qpushbutton created from Page1?
-
@marlenet15
well , say the place holder widget is called Wid2, (the one you promoted)
then you can access any widget using the normalui->Wid2->SomeButton
its being created in the ui_xx file for the UI that contains the promoted widgets.
-
Each widget should be self-contained so what exactly do you want to do with that button from another widget in your stack ?
-
I want to press that button to go the next page that is in the stack
-
In that case and from a design point of view, does it really belong to a widget inside the stack ?
-
Yes it does.
-
Then add a signal to that widget that will forward the button clicked signal. Something like nextPageRequested. That will be cleaner and easier to understand when you read the code.
-
I know but how am I supposed to access that widget when it is in another class?
connect(Page1->nextButton, SIGNAL(clicked()),this,SLOT(goToPage2()));
Where Page1 is the widget that contains the button "nextButton" and when you press it will go to Page2
-
That's what I wrote: you don't access the button, you only connect Page1.
Are you trying to re-implement QWizard ?
-
Yes but I do not want to use QWizard since I don't want it in that style. The only similarity is that I can go from one page to another.