Skip to content

Instantly share code, notes, and snippets.

@GaryLee
Created November 13, 2015 05:15
Show Gist options
  • Save GaryLee/3d2b74bbd25155d72e57 to your computer and use it in GitHub Desktop.
Save GaryLee/3d2b74bbd25155d72e57 to your computer and use it in GitHub Desktop.
QML Button which allow drop file to it.
Button {
id: button1
width: 230
height: 179
text: 'drag file to me'
DropArea {
id: fileDropArea
anchors.fill: parent
onEntered: {
drag.accept (Qt.CopyAction);
console.log("onEntered");
}
onDropped: {
if (drop.proposedAction == Qt.CopyAction) {
drop.acceptProposedAction()
}
console.log ("onDropped");
}
onExited: {
console.log ("onExited");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment