PDA

View Full Version : [QStackedWidget] adding widget to existing page



Tomasz
3rd December 2010, 12:32
Hello!

I'm trying to add widget to an existing page of QStackedWidget. My code:



widgetPointer = new myWidget(this);
widgetPointer->setLayout(ui->widgetLayout);
widgetPointer->setGeometry(QRect(0,0,430,310));
ui->stackedWidget->insertWidget(0, widgetPointer);
wykresStan->move(QPoint(0,0));


Widget adds to QStackedWidget but it also creates new page with index '0'. And my '0' page is now '1'. I've tried:



widgetPointer = new myWidget(ui->widgetLayout);


But widget added 'on top' of QStackedWidget. Any ideas?

thanks in advance
best regards
Tomasz

wysota
3rd December 2010, 13:02
Add the widget to the page and not to the stacked widget.