[Qt-interest] Stacked Abstracted Widget: how to change the page?
Kaleb Pederson
kaleb.pederson at gmail.com
Mon Jul 20 22:39:49 CEST 2009
On Mon, Jul 20, 2009 at 11:37 AM, Usman Ajmal<uzmanajmal at gmail.com> wrote:
> i know there is a slot of setCurrentIndex(int index) for changing the index
> of current page but i am getting error while using it.
>
> I write this in my ui_MainWindow.h
>
> QObject::connect(pushButton_next,
> SIGNAL(clicked()),stackedWidget,SLOT(setCurrentIndex(1)));
connect is only designed to establish a connection between signals and
slots. Thus, you should not pass '1' as a parameter to set current
index. Rather, you would have a SLOT in your code that would pass 1
as a parameter.
In other words, it might look something like this:
connect(pushButton_next, SIGNAL(clicked()), stackedWidget,
SLOT(setCurrentIndexToOne()));
... and then the slot:
void YourClass::setCurrentIndexToOne()
{
stackedWidget->setCurrentIndex(1);
}
HTH,
--Kaleb
More information about the Qt-interest-old
mailing list