Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Running and showing a certain page on stacked widget as default
Forum Updated to NodeBB v4.3 + New Features

Running and showing a certain page on stacked widget as default

Scheduled Pinned Locked Moved Solved Qt for Python
7 Posts 2 Posters 3.4k Views
  • 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.
  • G Offline
    G Offline
    georgehanna1993
    wrote on last edited by
    #1

    Hey guys,
    I'm trying to run an application with stacked widget.
    Is there a way to view a default page in the stacked widget?

    JonBJ 1 Reply Last reply
    0
    • G georgehanna1993

      Hey guys,
      I'm trying to run an application with stacked widget.
      Is there a way to view a default page in the stacked widget?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @georgehanna1993
      Just use QStackedWidget::setCurrentIndex/Widget() to set whichever page/widget you want before showing. Yes, you have to have the "default page" among its pages.

      G 1 Reply Last reply
      1
      • JonBJ JonB

        @georgehanna1993
        Just use QStackedWidget::setCurrentIndex/Widget() to set whichever page/widget you want before showing. Yes, you have to have the "default page" among its pages.

        G Offline
        G Offline
        georgehanna1993
        wrote on last edited by
        #3

        @JonB tried that, didn't work, is there any way to set an index for each page?
        How should it look like?

        JonBJ 1 Reply Last reply
        0
        • G georgehanna1993

          @JonB tried that, didn't work, is there any way to set an index for each page?
          How should it look like?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @georgehanna1993 said in Running and showing a certain page on stacked widget as default:

          @JonB tried that, didn't work

          In what way "didn't work"? It sets the specified page as the current one displayed.

          is there any way to set an index for each page

          Pages are indexed (from 0 upward) in the order you add them via QStackedWidget::addWidget(), or you can alter the order via QStackedWidget::insertWidget(). You can pass an index number to setCurrentIndex(), or you can pass the actual desired widget via setCurrentWidget().

          How should it look like?

          How should what look? The QStackedWidget will display whichever the previously-specified current index/widget is.

          QStackedWidget works fine. I do not know what your expectations might be.

          G 1 Reply Last reply
          0
          • JonBJ JonB

            @georgehanna1993 said in Running and showing a certain page on stacked widget as default:

            @JonB tried that, didn't work

            In what way "didn't work"? It sets the specified page as the current one displayed.

            is there any way to set an index for each page

            Pages are indexed (from 0 upward) in the order you add them via QStackedWidget::addWidget(), or you can alter the order via QStackedWidget::insertWidget(). You can pass an index number to setCurrentIndex(), or you can pass the actual desired widget via setCurrentWidget().

            How should it look like?

            How should what look? The QStackedWidget will display whichever the previously-specified current index/widget is.

            QStackedWidget works fine. I do not know what your expectations might be.

            G Offline
            G Offline
            georgehanna1993
            wrote on last edited by
            #5

            @JonB The code was created using QT designer, and i'm really new to all of this, that's why I'm asking for help:)

            1 Reply Last reply
            0
            • G Offline
              G Offline
              georgehanna1993
              wrote on last edited by
              #6

              Inside the code itself, I found that the QT Designer automatically assigned page number 3 to be the current Index, I changed it and it worked, Thanks!

              JonBJ 1 Reply Last reply
              0
              • G georgehanna1993

                Inside the code itself, I found that the QT Designer automatically assigned page number 3 to be the current Index, I changed it and it worked, Thanks!

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @georgehanna1993
                It probably just saves with whatever the last page you created, or edited, as the current one.

                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