Nikolai Prokoschenko
Nikolai Prokoschenko

Reputation: 8765

Which is the most generic view in Qt Quick Controls 2

I'm learning to work with QML and Qt Quick Controls 2 and try to figure out how to write "proper" applications with it (endgame is a small prototype for embedded devices).

One thing I'm missing is a simple and explicit way to build multi-page applications: there is StackView, TabView and SwipeView, but there is nothing like SimpleView, a component that I could put Page components into and then switch them via custom actions. Currently, I'm mis-using the SwipeView to achieve something similar, by setting interactive property to false, but I have to wonder whether this is a proper way.

So, which is the most generic "page container" component in Qt Quick Controls 2?

Upvotes: 0

Views: 114

Answers (1)

jpnurmi
jpnurmi

Reputation: 5836

Take a look at StackLayout from Qt Quick Layouts. It's a stack of arbitrary items, where you can control the index of the currently visible item.

StackLayout {
    anchors.fill: parent
    currentIndex: 1

    Page {
        // ...
    }

    Page {
        // ...
    }
}

Upvotes: 1

Related Questions