That's Wonderful .
1/2 of my problem 's been solved .
I've just noticed that when I drag & drop QStackedWidget using QT Design , Pages (instance of Widgets ) are created & added to the stacked widget .
I can add any number of pages I want & add the controls into it . I can control which widget to be displayed .
It works so great .
The second half of my problem :
- Whenever I try to declare instace of my .UI & add it to the QStackedWidget , Exception is appeared .
I've tried :
addWidget(WidgetObj);
widget(index );
insertWidget (index , WidgetObj);
CustomSlot's code that implements slots of the .UI & also has the QStackedWidget :
#include"CustomSlot2.h"
#include "ui_Form2.h"
#include "CustomSlot.h"
{
formTwo.setupUi(this);
//CustomSlot is the class that implement the slots of the .UI that I want to add at QStackedWidget
CustomSlot *CustomSlotObj ;
//formTwo.stackedWidget->addWidget(CustomSlotObj);
// I've already just 2 pages at QStackedWidget , The third on is going to be in index 2
formTwo.stackedWidget->insertWidget(2,CustomSlotObj);
WidgetObj= formTwo.stackedWidget->widget (2) ;
WidgetObj->show();
}
#include"CustomSlot2.h"
#include "ui_Form2.h"
#include "CustomSlot.h"
CustomSlot2::CustomSlot2(QWidget *parent): QWidget(parent)
{
formTwo.setupUi(this);
//CustomSlot is the class that implement the slots of the .UI that I want to add at QStackedWidget
CustomSlot *CustomSlotObj ;
//formTwo.stackedWidget->addWidget(CustomSlotObj);
// I've already just 2 pages at QStackedWidget , The third on is going to be in index 2
formTwo.stackedWidget->insertWidget(2,CustomSlotObj);
QWidget *WidgetObj;
WidgetObj= formTwo.stackedWidget->widget (2) ;
WidgetObj->show();
}
To copy to clipboard, switch view to plain text mode
Thanks .
Bookmarks