From e8c8eba9baaf1173d2359b39505b951bd489c8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Gro=C3=9F?= Date: Sat, 13 Jul 2024 23:49:35 +0200 Subject: [PATCH] Transfer DragArea --- CMakeLists.txt | 2 +- flake.nix | 2 +- src/qml/DragArea.qml | 40 ---------------------------------------- src/qml/PathView.qml | 1 + 4 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 src/qml/DragArea.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e04f52..a2708c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ if (UNIX AND NOT APPLE) endif() include(FetchContent) -FetchContent_Declare(quartz GIT_REPOSITORY https://github.com/vimpostor/quartz.git GIT_TAG v0.5) +FetchContent_Declare(quartz GIT_REPOSITORY https://github.com/vimpostor/quartz.git GIT_TAG 9f1ac6cce6b338c6613aa195cffe6f0bb5c965df) FetchContent_MakeAvailable(quartz) list(APPEND LINK_LIBS ${PKGCONFIG_MODULES}) diff --git a/flake.nix b/flake.nix index 9c71ea6..3939f87 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ owner = "vimpostor"; repo = "quartz"; rev = builtins.head (builtins.match ".*FetchContent_Declare\\(.*GIT_TAG ([[:alnum:]\\.]+).*" (builtins.readFile ./CMakeLists.txt)); - hash = "sha256-pXalJ4YUpqAtKJTSk/jHiWpB0he82wOF6iXzQU6AtwQ="; + hash = "sha256-UacYQ5c+MGUK4saLohnZs4691CBGI59JpkdgCaYbPUk="; }; makeStdenvPkg = env: env.mkDerivation { pname = "blobdrop"; diff --git a/src/qml/DragArea.qml b/src/qml/DragArea.qml deleted file mode 100644 index ea85a91..0000000 --- a/src/qml/DragArea.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick - -MouseArea { - property var target - property string dragUri: "" - property bool active: draggable.Drag.active - signal dragStarted() - signal dragFinished(var dropAction) - signal preDragStarted() - - id: mouseArea - drag.target: draggable - preventStealing: true - onPressed: { - preDragStarted(); - var w = target.width; - var h = target.height; - if (w > 64) { - w = 64; - h = h / w * 64; - } - target.grabToImage(function(result) { - draggable.Drag.imageSource = result.url; - }, Qt.size(w, h)); - } - Item { - id: draggable - anchors.fill: parent - Binding on Drag.active { - value: mouseArea.drag.active - delayed: true - } - Drag.mimeData: { "text/uri-list": dragUri } - Drag.dragType: Drag.Automatic - Drag.onDragStarted: dragStarted(); - Drag.onDragFinished: (dropAction) => { - dragFinished(dropAction); - } - } -} diff --git a/src/qml/PathView.qml b/src/qml/PathView.qml index 0828233..4c496b3 100644 --- a/src/qml/PathView.qml +++ b/src/qml/PathView.qml @@ -1,5 +1,6 @@ import QtQuick import QtQuick.Controls.Material +import Quartz import Backend