Qt 6.11 is out! See what's new in the release
blog
ListView elements not visible fully.
-
Hi,
I am trying to create a series of button using listview.
Problem I face is,- Even on slow swipe, Flick ended signal should trigger
- 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.
- 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.0ApplicationWindow {
id: root
width: 438
height: 102Component.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.