Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-76999

StackLayout: Add attached property 'index'

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.12.3
    • Quick: Layouts
    • None
    • All
    • 619dfbe8d02347cedb93a949cde627ec4424e0ae (qt/qtdeclarative/dev)
    • Shovelling Snow, Q1/2020 Finale

    Description

      It would be nice if StackLayout had an attached property 'index' or similar to be used in its children; e.g. TabBar has such a property already.

      When a StackLayout is used with a TabBar, they could be easily combined:

      TabBar {
        id: tabBar
        TabButton {
          text: "one"
        }
        TabButton {
          text: "two"
        }
      }
      StackLayout {
        currentIndex: tabBar.currentIndex
        Loader {
          source: "One.qml"
          active: parent.currentIndex === StackLayout.index // <- to be added
        }
        Loader {
          source: "Two.qml"
          active: parent.currentIndex === StackLayout.index // <- to be added
        }
      }

      Untested, but I hope it is possible to grasp the idea...

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              mitch_curtis Mitch Curtis
              peter-h-zeiss Peter H
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes