Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Flickable.pressDelay does not work on Android Mobile but works on Desktop [with small code example to reproduce]



  • Hi, i am developing an application with multi selection drag and drop.

    desired behavior:

    • select items for draging by tapping on the items
    • flicking by preform the flicking scrolling gesture
    • start with dragging after the user preforms presses on an item (i use ListView.pressDelay: 300 for this)

    This works for Desktop but on my Android mobile the dragging does not start if i set ListView.pressDelay: to 300.
    If I set ListView.pressDelay: to 30 its the same as if I set a value to ListView.pressDelay 300.
    If I set ListView.pressDelay: to 3. Dragging starts when i try to flick.

    Note: I get this Log message on my android mobile after trying to drag with ListView.pressDelay: to 300

    • W libuntitled27_armeabi-v7a.so: QMetaObject::invokeMethod: No such method AbstractButton_QMLTYPE_1::inputMethodQuery(Qt::InputMethodQuery,QVariant)

    code is on github: "https://github.com/werto87/qt_projects" branch: "list_view_model_cxx"

    short example for reproducing:
    import QtQuick 2.14
    import QtQuick.Controls 2.14
    import QtQuick.Layouts 1.14
    import QtQml.Models 2.14

    ApplicationWindow {
    id: root
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    ColumnLayout {
        anchors.fill: parent
        ListView {
            spacing: 5
            pressDelay: 300
            id: listView
            Layout.fillHeight: true
            Layout.fillWidth: true
            model: model
            delegate: AbstractButton {
                width: root.width
                height: 75
                id: delegate
                background: Rectangle {
                    color: "#9dbad5"
                }
            }
        }
    }
    Rectangle {
        //should be moveable pressDelay: 300
        visible: dragHandler.active
        id: rectangleToMove
        Drag.active: dragHandler.active
        width: 100
        height: 100
        color: "brown"
    }
    
    DragHandler {
        id: dragHandler
        xAxis.enabled: false
        target: rectangleToMove
        Drag.onDragStarted: {
            console.log("starting drag")
        }
    }
    
    ListModel {
        //just a model with some elements
        id: model
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
        ListElement {}
    }
    

    }

    edit: added example for easy reproducing
    edit2: added log message



  • This might be related to mouse messages in Android having been broken in some Qt 5.12 version and not (AFIK) fixed since. You could verify this with Qt 5.11.3 and after that perhaps figure out a workaround.



  • Thank you mvuori, i will try it out.



    • Setting the Qt Version to .11 is no solution for me because i want to use DragHandler (DragHandler is from Qt 5.12 i think?).
    • Installing qt 5.14 did not help.
    • getting arm version 8 did not help

    I noticed a log when trying to drag and drop on android:

    W MY_APP_NAME_armeabi-v7a.so: QMetaObject::invokeMethod: No such method QQuickContentItem::inputMethodQuery(Qt::InputMethodQuery,QVariant)

    I will try to get version 8

    edit: getting version 8 did not help



  • added small example code to reproduce the problem


Log in to reply