in program
mainwindow.cpp
designer: mainwindow.ui--> Qstackedwidget having pages 4;
in each page a 'frame' say frame1, frame 2,frame 3, frame 4;
beside the stacked widget three 'pushbutton' say pButton1,pButton2,pButton3
so constructing
class MainWindow
: public QDialog,
public Ui
::MainWindow setupUi(this) ;
connect(pButton1 , SIGNAL(clicked()), this, SLOT(nextPage1()));
void MainWindow::nextPage1()
{
stackedWidget->setCurrentIndex(0);
}
connect(pButton2 , SIGNAL(clicked()), this, SLOT(nextPage2()));
void MainWindow::nextPage2()
{
stackedWidget->setCurrentIndex(1);
}
connect(pButton1 , SIGNAL(clicked()), this, SLOT(nextPage3()));
void MainWindow::nextPage3()
{
stackedWidget->setCurrentIndex(4);
}
/*so if we click the three buttons the stack widget will change the pages - right!*/
class MainWindow : public QDialog, public Ui::MainWindow
setupUi(this) ;
connect(pButton1 , SIGNAL(clicked()), this, SLOT(nextPage1()));
void MainWindow::nextPage1()
{
stackedWidget->setCurrentIndex(0);
}
connect(pButton2 , SIGNAL(clicked()), this, SLOT(nextPage2()));
void MainWindow::nextPage2()
{
stackedWidget->setCurrentIndex(1);
}
connect(pButton1 , SIGNAL(clicked()), this, SLOT(nextPage3()));
void MainWindow::nextPage3()
{
stackedWidget->setCurrentIndex(4);
}
/*so if we click the three buttons the stack widget will change the pages - right!*/
To copy to clipboard, switch view to plain text mode
now
in same mainwindow.cpp
#include "panel.h" /* an external program */
Panel *panel = new Panel();
layout->addWidget(panel);
frame1->setLayout(layoout);
/*[I]so now the panel will be loaded to the page 1 --right![/I] * /
#include "panel.h" /* an external program */
Panel *panel = new Panel();
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(panel);
frame1->setLayout(layoout);
/*[I]so now the panel will be loaded to the page 1 --right![/I] * /
To copy to clipboard, switch view to plain text mode
this is the setup in mainwindow.cpp program
in panel.cpp
designer: subwindow.ui ->three pushbuttons say subButton1,subButton2,subButton3
so constricting
class Panel2
: public QDialog,
public Ui
::SubWindowsetupUi(this)
class Panel2 : public QDialog, public Ui::SubWindow
setupUi(this)
To copy to clipboard, switch view to plain text mode
this is my program looks like
in mainwindow
clicking pButton1->stackedWidget->page1
clicking pButton2->stackedWidget->page2
clicking pButton3->stackedWidget->page3
now i want
in panel
clicking subButton1->stackedWidget(mainwindow's)->page4
that is i have to change the mainwindow's stackedwidget page from clicking panel's subButton1
this is my problem how can i solve it "please help me"
Bookmarks