macOS - issues with scrolling when nesting ListViews



  • Hi

    I'm running into a weird issue on macOS (on Windows works fine) in Qt 5.12.
    I have a vertical ListView (scrolling top-down) that contains ListViews (scrolling left-right).

    It looks like I can't scroll vertically when cursor is over nested ListView, however when cursor is located inside spacing area I can scroll until cursor hits another child ListView.

    Below you can find an example of this behavior, with commented out MouseArea hacks to make it work on macOS.

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    
    ApplicationWindow {
        id: window
        visible: true
        width: 640
        height: 480
        title: "Test"
    
        ListView {
            id: listView
            anchors.fill: parent
            focus: true
            property var horizontalListViewUnderCursor
    
            model: ListModel {
                ListElement { color: 'yellow' }
                ListElement { color: 'green' }
                ListElement { color: 'cyan' }
            }
    
            spacing: 80
            KeyNavigation.up: listView.headerItem
            flickableDirection: Flickable.VerticalFlick
    
    //        MouseArea {
    //            anchors.fill: parent
    
    //            onWheel: {
    //                if (wheel.angleDelta.x !== 0) {
    //                    if (listView.horizontalListViewUnderCursor) {
    //                        listView.horizontalListViewUnderCursor.cancelFlick();
    //                        listView.horizontalListViewUnderCursor.flick(wheel.angleDelta.x * 10, 0);
    //                    }
    //                }
    
    //                if (wheel.angleDelta.y !== 0) {
    //                    listView.cancelFlick();
    //                    listView.flick(0, wheel.angleDelta.y * 10);
    //                }
    //                wheel.accepted = true
    //            }
    //        }
    
            delegate: ListView {
                id: internalList
                height: 200
                width: 500
                spacing: 10
                orientation: ListView.Horizontal
                flickableDirection: Flickable.HorizontalFlick
    
    //            MouseArea {
    //                anchors.fill: parent
    //                hoverEnabled: true
    
    //                onWheel: {
    //                    wheel.accepted = false;
    //                }
    
    //                onEntered: {
    //                    listView.horizontalListViewUnderCursor = parent;
    //                }
    
    //                onExited: {
    //                    listView.horizontalListViewUnderCursor = null;
    //                }
    //            }
    
                model: ListModel {
                    ListElement { alpha: 0.1 }
                    ListElement { alpha: 0.2 }
                    ListElement { alpha: 0.3 }
                    ListElement { alpha: 0.4 }
                    ListElement { alpha: 0.5 }
                    ListElement { alpha: 0.6 }
                    ListElement { alpha: 0.7 }
                    ListElement { alpha: 0.8 }
                    ListElement { alpha: 0.9 }
                    ListElement { alpha: 1.0 }
                }
    
                delegate: Item {
                    property variant myData: model
    
                    height: 200
                    width: 200
    
                    Rectangle {
                        anchors.fill: parent
                        color: 'blue'
                        opacity: model.alpha
                    }
                }
            }
        }
    }
    

  • Qt Champions 2018

    I am on macOS 10.13.6 and your example works fine with the MouseArea code still commented out.
    I can flick using the mouse and scroll with wheel.



  • Thanks for reply! Have you tried it on Magic Trackpad/Macbook trackpad? Just connected a mouse and scroll indeed works fine, however on trackpad this issue is still present.

    I'm running macOS 10.14.1.



  • Bump, since the issue still exists.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.