Re: Help with QStackedWidget
this connection is wrong
Code:
QObject::connect(bChange,
SIGNAL(clicked
()), menus,
SLOT(setCurrentIndex
(3)));
//3 -- wrong
.
read carefully about signal&slots
Re: Help with QStackedWidget
Thank for spending your time reading my code, spirit.
I´ve read about signals and spots but I still haven't found the point. Could you give more clues?? I supose I have to define a slot function to change the page. I´m not sure how.
Re: Help with QStackedWidget
you is not careful. :)
your connection is
Code:
QObject::connect(bChange,
SIGNAL(clicked
()), menus,
SLOT(setCurrentIndex
(3)));
it's not correct, because passing real values in connection IS NOT allowed.
so, your connection must look like
Code:
QObject::connect(bChange,
SIGNAL(clicked
()), menus,
SLOT(setCurrentIndex
(int)));
i.e. you should specify SIGNATURE of method.
Re: Help with QStackedWidget
Ok. But now, how do I link that button with the MenuThree?? Do I have to use QSignalMapper??
what is exactly the signature (of a signal or slot)???
Thank you again, spirit!! And sorry for being worse than a headache.
Re: Help with QStackedWidget
add a slot which changes pages:
Code:
....
QObject::connect(bChange,
SIGNAL(clicked
()),
this,
SLOT(changePage
()));
....
void MyWidget::changePage()
{
int nextPage = menus->currentIndex() + 1;
if (nextPage >= menus->count())
nextPage = 0;
menus->setCurrentIndex(nextPage);
}
...
should be something like this.
Re: Help with QStackedWidget
That wasn´t exactly what I wanted. But it helped me a lot to solve my problem.
Thank so much, spirit!!!