Get file info when dropping a file in DropArea



  • Hi all,

    I have a DropArea in my QML app and I would like to drag and drop an external file in my app (in order to get the file path).
    The drop event works but I cannot find how to get file data from drop/drag event ...
    Any idea ?

    @
    Rectangle {
    width: 300;
    height: 300;

        DropArea {
            id: dropArea;
            anchors.fill: parent;
            
            onDropped: {
                console.log ("onDropped");
                console.log(drag);
                console.log(drop);
            }
        }
    }
    

    @



  • I'm not sure if this is possible yet.
    See "bug report":https://bugreports.qt-project.org/browse/QTBUG-27125



  • The DropArea component uses the QQuickDropEvent class which does not give access to mime data like the QDropEvent class does. Why don't you try creating your own custom qml component and override the dropEvent function which uses the QDropEvent class. That way you would have access to the file path.


Log in to reply
 

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