Thanks , it works successfully .
I 've one more question :
- I've added many QWidgets into stack . Now I need when the turn comes to a particular widget to be shown , I can access its variables .
Qt Code:
#include "Container.h" { ContainerUi.setupUi(this); PageIndex=1; CustomSlot1 *CustomSlot1Obj =new CustomSlot1(); CustomSlot2 *CustomSlot2Obj=new CustomSlot12(); CustomSlot3 *CustomSlot3Obj=new CustomSlot3(); //........................ to CustomSlot9 // Push objects into the QStackedWidget ContainerUi.StackedWidget->addWidget(CustomSlot1); ContainerUi.StackedWidget->addWidget(CustomSlot2); ContainerUi.StackedWidget->addWidget(CustomSlot3); //.................. pust the other Widgets into the Stack ContainerUi.StackedWidget->setCurrentIndex(PageIndex); PageIndex++; } void Container :: NextPage() { int CurrentIndex=ContainerUi.StackedWidget->currentIndex (); if(PageIndex <10) { if(CurrentIndex==3 ) { CustomSLot3 *widget ; widget=ContainerUi.StackedWidget->widget (3); // GrainSizeFlag is a public variable at CustomSlot3 if(widget->GrainSizeFlag==true) ::PageIndex=7; } ContainerUi.StackedWidget->setCurrentIndex(PageIndex); PageIndex++; } }To copy to clipboard, switch view to plain text mode
By default the Stack contains one widget . So my "CustomSlot" 'll go to the index [1].
As a result of that , CustomSlot3 'll go to index [3].
I've an error that tells ms : Invalid Conversion QWidget* to CustomSlot3*
Thanks .
Bookmarks