From: APTX Date: Sun, 12 Mar 2017 16:56:43 +0000 (+0100) Subject: Allow files to be opened by drag&drop X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=61a17ec75f387c2e7efaa89ba767bf522abb0a09;p=aniplayer.git Allow files to be opened by drag&drop --- diff --git a/uiplugins/ui_desktop_qml_default/qml/main.qml b/uiplugins/ui_desktop_qml_default/qml/main.qml index 4834bfb..973e198 100644 --- a/uiplugins/ui_desktop_qml_default/qml/main.qml +++ b/uiplugins/ui_desktop_qml_default/qml/main.qml @@ -106,6 +106,26 @@ Window { cursorShape: !controls.visible && window.visibility === Window.FullScreen ? Qt.BlankCursor : Qt.ArrowCursor; } + DropArea { + anchors.fill: parent + onEntered: { + if (!drag.hasUrls) { + drag.accepted = false; + return false; + } + return true; + } + + onDropped: { + if (!drop.hasUrls) { + drop.accepted = false; + return false; + } + var file = drop.urls[0]; + player.loadAndPlay(file); + } + } + PlayerControls { id: controls controlledPlayer: player