Thanks, it solved now.
For those who implement stack widget pages using pushbutton, here is snippet of code.
in a simple way. As I am using 3-4 buttons it is easy to use this way.
May be for more number of buttons you can choose any other method for best use.
Code:
static int currentIndex = 0; // Global
.......
......
....
class::class() ///constructor
{
QObject::connect(pushbutton1, clicked
(),
this, page1
());
QObject::connect(pushbutton2, clicked
(),
this, page2
());
}
void class::page1()
{
currentIndex = stackedWidget->currentIndex();
if( currentIndex < stackedWidget->count())
{
stackedWidget->setCurrentIndex(0); // page1
}
}
void class::page2()
{
currentIndex = stackedWidget->currentIndex();
if( currentIndex < stackedWidget->count())
{
stackedWidget->setCurrentIndex(1); // for page2
}
}
static int currentIndex = 0; // Global
.......
......
....
class::class() ///constructor
{
QObject::connect(pushbutton1, clicked(), this, page1());
QObject::connect(pushbutton2, clicked(), this, page2());
}
void class::page1()
{
currentIndex = stackedWidget->currentIndex();
if( currentIndex < stackedWidget->count())
{
stackedWidget->setCurrentIndex(0); // page1
}
}
void class::page2()
{
currentIndex = stackedWidget->currentIndex();
if( currentIndex < stackedWidget->count())
{
stackedWidget->setCurrentIndex(1); // for page2
}
}
To copy to clipboard, switch view to plain text mode
Note: For other buttons and pages replace stackedWidget->setCurrentIndex(number with appropriate page).
Thanks & Regards,
Arun.
Bookmarks