QML DropArea: drop an external file does not work
-
Hi,
I have a QML application and I would like to enable an area to drop there an external file (dragged from Windows explorer, for instance) and show the file path in my application.
I have a really simple test qml to try, but I can not drop anything ("not accepted" cursor is displayed when I enter my DropArea dragging the file).
My code:
import QtQuick 2.1 import QtQuick.Controls 1.0 ApplicationWindow { title: qsTr("Drop Area test") width: 800 height: 600 visible: true DropArea { id: drop anchors.fill: parent enabled: true onEntered: console.log("entered"); onExited: console.log("exited") onDropped: console.log("dropped") } Text { id: textDrop anchors.centerIn: parent text: "Drop an element" } }
I supponse I am doing anything wrong, but I can not fix it...
Thanks in advance
-
@Diego-Donate There was a bug reported but it is Linux specific. Looks like it was not solved for Windows. Which Qt version did you try ?
-
@Diego-Donate There was a bug reported but it is Linux specific. Looks like it was not solved for Windows. Which Qt version did you try ?
@p3c0 I tried with QT 5.7
-
@Diego-Donate Well then you should report new one. And mention the OS and Qt version.
-
@Diego-Donate Well then you should report new one. And mention the OS and Qt version.
@p3c0 Have you tried my code? I thought it is so simple that it should work... I could not imagine it is a QT bug!! :(
-
@Diego-Donate You can try the official example:
http://doc.qt.io/qt-5/qtquick-externaldraganddrop-example.htmlTry dropping external file into the second tile. If it succeeds it will display the file name.
It works on Ubuntu 14.04 with Qt 5.6
-
@Diego-Donate You can try the official example:
http://doc.qt.io/qt-5/qtquick-externaldraganddrop-example.htmlTry dropping external file into the second tile. If it succeeds it will display the file name.
It works on Ubuntu 14.04 with Qt 5.6
@p3c0 Ok, the example does not work for me in Windows 7 (QT 5.7)... I can drag and drop text from one tile to another inside the window, but nothing happens if i drag a file or text from out of the application...
I will notify it in case it is a bug... can it be??
-
@Diego-Donate According to me, yes, it is a bug.
-
@Diego-Donate According to me, yes, it is a bug.
@p3c0 The official example works for me when I drag and drop text from outside the application, but nothing happens when I try to drag a file, should it show the file name? Or it is only for text?
-
-
@p3c0 Thanks for your time. It seemed to be something related to my QT installation, I reinstalled QT package and now it works... I don't know why!!!
-
@Diego-Donate Glad to know that it works on Windows with Qt 5.7. Did you also check the official example ?
-
@Diego-Donate Glad to know that it works on Windows with Qt 5.7. Did you also check the official example ?
@p3c0 Yes, it is the same, I am not sure why but now I have it all working... Thanks a lot