Update QStackedWidget
-
I have a QStackedWidget with 4 pages and I'm using a QComboBox to switch page. None of the pages have more than 3 child widgets. I set up this widget in designer and add child widgets in my constructor.
Sometimes, when I switch page the stacked widget doesn't redraw. Specifically,
- I select the page using the combo.
- The combo does not change text, the page does not change.
- If you move the mouse over the combo/stack, the widgets update to the correct state.
I set up an intermediate slot with an update(), but it doen't make any difference:
@
...
connect(pageChooseCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setPage(int)));
...void ThisClass::setPage(int page)
{
stack->setCurrentIndex(page);
stack->update();
}
@Does anyone have any suggestions about how to update the widgets ?
Platform: Qt 5.1.0 on Mac 10.8.
-
Hi, seems the problem is
bq. select the page using the combo. The combo does not change text
Which means QCombo doesn't work correctly.
Can you reproduce this problem without QStackedWidget?
-
I added a QLabel to my layout and then changed the setPage slot as follows:
@
void ThisClass::setPage(int page)
{
/*
stack->setCurrentIndex(page);
stack->update();
*/debugLabel->setText(QString::number(page));
}
@I observed the same problem.
The slot is the only signal connection to/from the combo. So I guess QComboBox has a problem.