Unsolved Trouble getting Item of PathView to center
-
Hello,
I'm trying to make a PathView. It works quite well for now exceptfor one detail.
When I move the PathView with a drag and stop it, it can stop anywhere. Wich make it not centered as it should be.
Here is an example of the wrong behaviour :
I'm expecting that result : (I got this result most of the time but I just want to avoid the behaviour I described above)
I tried to play with the snapMode property but nothing changed.
Here is the code of the PathView :PathView { id: pathView anchors.fill: parent model: tumblerModel pathItemCount: 5 preferredHighlightBegin: 0.5 preferredHighlightEnd: 0.5 highlightRangeMode: PathView.StrictlyEnforceRange delegate: tumblerDelegate path: Path { startX: parent.width/2; startY: 0 PathAttribute { name: "iconScale"; value: 0.7 } PathAttribute { name: "iconOpacity"; value: 0.2 } PathLine {x: parent.width/2; y: 100 } PathAttribute { name: "iconScale"; value: 2 } PathAttribute { name: "iconOpacity"; value: 1 } PathLine {x: parent.width/2; y: 200 } } }
Does anybody know how can I force the item to center ?
-
@DavidM29
What about usingPathPercent
elements as in the Qt Cadaques book:
https://qmlbook.github.io/ch06/index.html#the-pathviewThe example below demonstrates how the PathView element is used to create view of cards that the user can flip through. It employs a number of tricks to do this. The path consists of three PathLine elements. Using PathPercent elements, the central element is properly centered and provided enough space not to be cluttered by other elements.
Hope it helps.
-
I'm looking into it ! Thanks
-
-
@6thC
I tried this but it does not change anything... I don't know why. But I found out that the problem is present only in my virtual environment, it works fine on the final device, at least for now.