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"
}
}
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"
}
}
To copy to clipboard, switch view to plain text mode
I supponse I am doing anything wrong, but I can not fix it...
Thanks in advance,
Diego
Bookmarks