-1

I've searched a method into QT5 Docs and I couldn't find anything regarding a function that can get me all the elements within the StackWidget.

I have a StackWidget which contains the pages for my application, but so far the only way I found in order to be able to change that the page is this function setCurrentIndex which needs to take an index of that specific page. Is the anyway a function or something which cand return the name of the elements from that stackWidget or a way in which I can use the name of that object in order to change the page, not the index.

scopchanov
  • 7,966
  • 10
  • 40
  • 68
Mircea
  • 1,671
  • 7
  • 25
  • 41
  • You can iterate over all children of the stack widget to find a specific. The resp. functions are inherited from the very super class `QObject`. (FYI: [SO: QFileDialog: force file name](https://stackoverflow.com/a/62695494/7478597)) – Scheff's Cat Jul 04 '20 at 11:00

1 Answers1

0

You may name your stack widgets using QObject::setObjectName function, and then iterate over them to find desired widget using its name, which is QObject::objectName.

Ali Tavakol
  • 405
  • 3
  • 11