Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Flexible layout

Flexible layout

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlstackviewresponsive
1 Posts 1 Posters 861 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.
  • J Offline
    J Offline
    jimcad
    wrote on 23 Feb 2016, 14:06 last edited by jimcad
    #1

    I have a multipage app that is built with StackView. I would like change layout to more flexible. Especially using tablet, it would be nice to show menu and a page in parallel column when screen is horizontal orientation. So how to build flexible layout based on screen orientation and size? Here is an example what I mean http://v-play.net/doc/images/update-271-menu-resolution-changer.gif

    Here is a part of my current implementation:

    ApplicationWindow {
        visible: true
        width: 480
        height:640
        title: qsTr("Hello World")
    
        StackView {
            id: stackView
            anchors.fill: parent
            initialItem: Rectangle {
                ListView {
                    anchors.fill: parent
                    model: ListModel {
                        ListElement {
                            title: "page 1"
                            page: "pages/page1.qml"
                        }
                        ListElement {
                            title: "page 2"
                            page: "pages/page2.qml"
                        }
                    }
                    delegate: Rectangle {
                        width: stackView.width
                        height: 50
                        border.width: 1
                        Text {
                            anchors.fill: parent
                            horizontalAlignment: Text.AlignHCenter
                            verticalAlignment: Text.AlignVCenter
                            text: title
                            MouseArea {
                                anchors.fill: parent
                                onClicked: stackView.push(Qt.resolvedUrl(page))
                            }
                        }
                    }
                }
            }
        }
    
    1 Reply Last reply
    0

    1/1

    23 Feb 2016, 14:06

    • Login

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