Nominate our 2022 Qt Champions!

Accessing nested QStackedWidget pages

  • HI,
    I created a QStackedWidget with 2 pages using Qt Designer, stackedWidget. The second page of stackedWidget contains 2 Widgets. The top widget is used for navigation and the bottom one contains content. The bottom Widget also contains the second QStackedWidget, stackedWidget_2. stackedWidget_2 currently contains 2 pages.

    What I'm having difficultly accomplishing is the following:
    On page 2 of stackedWidget, which contains the 2 Widgets, the content Widget which contains the 2nd stackedWidget has 2 pages. Page 1 is part of a form with a button (save & continue) that lead to Page 2, the other part of the form.

    I created a go to slot for the save & continue button to lead to Page 2 but it doesn't work. The code I have inside the on_clicked() is :

    Is this the correct way to access it?

  • Lifetime Qt Champion

    it sounds correct.

    So in what way is it not working ?

    It does call
    but nothing happens?

    you can use qDebug() << "im called"; in your slot to see if its actually called.
    (include <qDebug>)

  • @mrjj

    I'm kind of new to using the debugger so I hope I didn't miss anything. I added the code you suggested. It compiled and ran fine. When I clicked the save & continue button, nothing happened. I went back to the Qt Creater to check "3 Application Output" had one line "Debugging has finished".

    Is there anything else I can try?

    I added qDebug() << "Search"; for the search button and it printed when I clicked it. The Search button is part of the navigation.

  • Lifetime Qt Champion

    so save & continue button does not trigger its slot?
    Did u rename button after creating slot?

  • This post is deleted!

  • @mrjj

    Thank you very much :)

    I renamed the button. Had to remove it the old name entry from mainwindow.h and it's working. Thanks again :)

Log in to reply