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

StackLayout: Add attached property 'index'

XMLWordPrintable

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

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

        For Gerrit Dashboard: QTBUG-76999
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes