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 inside PathView = broken touchscreen scrolling
Forum Updated to NodeBB v4.3 + New Features

ListView inside PathView = broken touchscreen scrolling

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
touch screenpathviewlistview
2 Posts 2 Posters 75 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.
  • H Offline
    H Offline
    huma-v
    wrote last edited by huma-v
    #1

    I'm developing an application using PySide 6.9 that features lists of items encapsulated inside a carousel.
    For that I used a PathView with a horizontal path (since I prefer its looping), with a vertical ListView inside its delegate. When testing this configuration with mouse, I get expected results (horizontal swipe scrolls the PathView, vertical - ListView), but when I try the same with a touchscreen device (running Windows 10 and Linux Mint), when I swipe horizontally (over an area covered by a ListView) it scrolls only for a couple pixels at a time before stopping, what is also interesting, after scrolling in such a way, the PathView doesn't snap back to preferredHighlightBegin/preferredHighlightEnd.

    When I build a similar configuration but using two nested ListViews instead, outer Horizontal, inner Vertical, I observe expected behavior (same smooth scrolling both both ways as when using mouse), but I lose the desired looping.

    Can I consider it a bug of the implementation?
    Do any workarounds for this behavior exist?

    Minimal example attached

    import QtQuick
    
    
    Window {
        id: root
    
        width: 800; height: 600
        visible: true
    
        PathView {
            anchors.fill: parent
    
            model: 6
            pathItemCount: 3
            preferredHighlightBegin: 0.5
            preferredHighlightEnd: 0.5
            highlightRangeMode: ListView.StrictlyEnforceRange
            dragMargin: height / 2
    
            path: Path {
                startX: -root.width * 0.3
                startY: root.height / 2
    
                PathLine {
                    x: root.width * 1.3
                    y: root.height / 2
                }
            }
    
            delegate: Rectangle {
                width: root.width / 2
                height: PathView.view.height
    
                color: "#888888"
    
                ListView {
                    anchors.fill: parent
                    anchors.leftMargin: 5
                    anchors.rightMargin: 5
                    spacing: 5
                    model: 6
    
                    delegate: Rectangle {
                        width: ListView.view.width
                        height: 40
    
                        color: "white"
                    }
                }
            }
        }
    }
    
    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote last edited by GrecKo
      #2

      I would make my model looping as a workaround.
      Maybe a proxy model working with your view? Exposing 1 mirror of your model before the

      1 2 3 4  1 2 3 4  1 2 3 4
               x  <-- start index of your view
      

      Ensure that the index is always in the middle part of the model.
      If the current index of the views goes in the first part, "remove" the last part and "insert" a new mirror part in front so that the index is now in the middle again. Same thing if it goes to the last part, shift the first part at the end.

      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