Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Accessing nested QStackedWidget pages
Forum Updated to NodeBB v4.3 + New Features

Accessing nested QStackedWidget pages

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WhatIf
    wrote on last edited by
    #1

    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 :
    ui->stackedWidget_2->setCurrentIndex(1);

    Is this the correct way to access it?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      it sounds correct.

      So in what way is it not working ?

      It does call
      ui->stackedWidget_2->setCurrentIndex(1);
      but nothing happens?

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

      W 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        it sounds correct.

        So in what way is it not working ?

        It does call
        ui->stackedWidget_2->setCurrentIndex(1);
        but nothing happens?

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

        W Offline
        W Offline
        WhatIf
        wrote on last edited by WhatIf
        #3

        @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.

        mrjjM 1 Reply Last reply
        0
        • W WhatIf

          @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.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          W 1 Reply Last reply
          0
          • W Offline
            W Offline
            WhatIf
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • mrjjM mrjj

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

              W Offline
              W Offline
              WhatIf
              wrote on last edited by
              #6

              @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 :)

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved