Qt 6.11 is out! See what's new in the release
blog
How to retrieve the currentPageName property of QStackedWidget
-
When editing a QStackedWidget from QtCreator you can set a currentPageName property:

But I cannot find how to retrieve this value from code.
Even the doc page of QStackedWidget does not mention it.I tried in this way guessing it was a custom property:
ui->stackedWidget->setCurrentIndex(0); qDebug() << ui->stackedWidget->property("currentPageName");but it returns an invalid value.
-
It's not a property. If you look at the generated code it's just a shortcut for setting the variable and object name i.e. something like this:
page = new QWidget(); page->setObjectName("page"); stackedWidget->addWidget(page);so to get it back you would do:
ui->stackedWidget->currentWidget()->objectName() -
M Mark81 has marked this topic as solved on