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. ListView wrap around
Forum Updated to NodeBB v4.3 + New Features

ListView wrap around

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 4.3k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    richterX
    wrote on last edited by
    #1

    Hi,
    I am trying to get a ListView to wrap around and I don't know why it isn't working. I set keyNavigationWraps to true but this doesn't seem to work with the Flick and also I don't know what key presses this is tied to.

    Here is my code:
    @
    import QtQuick 1.0

    Rectangle {
    id: mainWindow
    width: 800; height: 600
    color: "#0E113D"

    Column {
        anchors.fill: parent
        z: 1
        MyHeader{
            id: header
            anchors.top: parent.top
            anchors.horizontalCenter: parent.horizontalCenter
        }
    
        //list view will display a model according to a delegate
        ListView {
            id: myListView
            width:parent.width; height: parent.height - header.height
    
            //the model contains the data
            model: myListModel
    
            //control the movement of the menu switching
            snapMode: ListView.SnapOneItem
            orientation: ListView.Horizontal
            boundsBehavior: Flickable.StopAtBounds
            flickDeceleration: 5000
            highlightFollowsCurrentItem: true
            highlightMoveDuration:240
            highlightRangeMode: ListView.StrictlyEnforceRange
            keyNavigationWraps: true
        }
    }
    
    VisualItemModel {
        id: myListModel
    
        FirstView {
            id: firstView
            width: myListView.width; height: myListView.height
        }
        SecondView {
            id: secondView
            width:  myListView.width; height: myListView.height
        }
        ThirdView {
            id: thirdView
            width:  myListView.width; height: myListView.height
        }
    }
    

    }@

    What I want is when you flick right on thirdView for it to go back to firstView. Likewise, if you flick left on firstView, it should go to thirdView. Also, if there is a quick answer to how to bind key presses, I'd appreciate it.
    Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      You could use a pathview to do that. A pathview is wrapping, a listview is not.

      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