Intercepting and relaying touch events to child items



  • Hi Folks,
    I'm a newbie to Qt, trying to recreate some custom touch processing code. Can you set up a MultiPointTouchArea to intercept touch events, then selectively pass those events on to child items, all within QML? Specifically, I have a ListView that should scroll when I swipe vertically, but I would like to be able to reposition the ListView horizontally if the user's touch moves horizontally. I have tested this with embedding a ListView in a Flickable object, which works for one ListView, but I have a number of ListViews (panes on a multitiered browsing tree) that need to be laid out with respect to the moving ListView.

    I envision something like thise:

    @ListView {
    id: firstList
    // details
    }

    MultiPointTouchArea {
    touchPoints: [
    TouchPoint { id: point1 }
    ]
    onPressed:
    {
    if ( /* test for horizontal move */ )
    firstList.x: point1.x
    else
    firstList.onPressed(point1)
    }
    }@

    Is this possible in QML or do I need to work this kind of logic in C++ with signals and slots instead? Thanks a ton for the help.
    Cheers,
    Dave


Log in to reply
 

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