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. Get file info when dropping a file in DropArea
Forum Update on Monday, May 27th 2025

Get file info when dropping a file in DropArea

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 2.9k 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.
  • A Offline
    A Offline
    apap_
    wrote on 3 Apr 2013, 14:08 last edited by
    #1

    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);
            }
        }
    }
    

    @

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JapieKrekel
      wrote on 14 Apr 2013, 21:21 last edited by
      #2

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        melghawi
        wrote on 15 Apr 2013, 23:28 last edited by
        #3

        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.

        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