PDA

View Full Version : Access objects inside QStackedWidget widgets.



Trader
25th July 2010, 17:12
Hi guys, I need your help.

I have 2 QWidget Forms (form1, Form2) within a QStackedWidget (formstack); the attached project has two problems:

1) within Form1, I can’t access objects inside QStackedWidget father (formstack).
2) within Form2, I can’t access objects inside Form1.

Thank you in advance for your help.

Lykurg
25th July 2010, 18:15
Please only post in one forum. We read all! You have two possibilities: pass pointers around, which is the worst solution, or better use the signal slot mechanism to "transfer" informations between widgets.

Trader
25th July 2010, 18:38
Lykurg, can you show me a code sample? (or edit my code). Tks.

Lykurg
25th July 2010, 19:15
Lykurg, can you show me a code sample? (or edit my code). Tks.
No, try yourself first. And for this
stackedWidget->setCurrentIndex(stackedWidget->indexOf(form1)); better use QStackedWidget::setCurrentWidget().