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 elements not visible fully.
Qt 6.11 is out! See what's new in the release blog

ListView elements not visible fully.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 289 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.
  • D Offline
    D Offline
    dsba
    wrote on last edited by dsba
    #1

    Hi,
    I am trying to create a series of button using listview.
    Problem I face is,

    1. Even on slow swipe, Flick ended signal should trigger
    2. Highlighted item does not visible fully after swipe. Example last element i.e 13 is highlighted, and its moved out of visible area to its right, then it doesn't resume back being fully visible.
    3. When Spring backs to first element, how to remove animation?

    import QtQuick 2.12
    import QtQuick.Window 2.0
    import QtQuick.Controls 2.12
    import QtGraphicalEffects 1.0

    ApplicationWindow {
    id: root
    width: 438
    height: 102

    Component.onCompleted: {
        list.currentIndex = 0
        list.positionViewAtBeginning()
    }
    
    ListView {
        id: list
        anchors.fill: parent
        focus: true
        clip: true
        anchors.leftMargin: 12
        anchors.rightMargin: 12
        spacing: 12
        model: 14
        delegate:
            Button {
            id: button
            text: index
            width: list.currentIndex === index ? 82 : 50
            height: list.currentIndex === index ? 82 : 50
            y: list.currentIndex === index ? 9 : 18
            onClicked: list.currentIndex = index
            focus: true
            antialiasing: true
        }
        orientation: ListView.Horizontal
        highlightFollowsCurrentItem: true
        boundsBehavior: Flickable.StopAtBounds
        onFlickEnded: positionViewAtIndex(currentIndex, ListView.Visible)
    }
    

    }

    Thanks in advance.

    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