From ebbcf7ace6d8ea576ca49841b3dc19a623183272 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Sun, 29 Sep 2024 13:36:16 +0800 Subject: [PATCH] fix: double click to activate the detail window fix the double click to activate the detail window Log: fix the double click to activate the detail window Bug: https://pms.uniontech.com/bug-view-269597.html --- src/deepin-album.qrc | 1 + src/qml/Control/ListView/ThumbnailListDelegate.qml | 7 ++++++- src/qml/Control/ListView/ThumbnailListShare.js | 7 +++++++ src/qml/Control/ListView/ThumbnailListViewAlbum.qml | 7 +++++-- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/qml/Control/ListView/ThumbnailListShare.js diff --git a/src/deepin-album.qrc b/src/deepin-album.qrc index a27fc638..5a4c1f87 100644 --- a/src/deepin-album.qrc +++ b/src/deepin-album.qrc @@ -78,5 +78,6 @@ qml/Control/MonthImage.qml qml/Control/Animation/SwitchViewAnimation.qml qml/Control/Animation/FadeInoutAnimation.qml + qml/Control/ListView/ThumbnailListShare.js diff --git a/src/qml/Control/ListView/ThumbnailListDelegate.qml b/src/qml/Control/ListView/ThumbnailListDelegate.qml index aefcd33f..e80f25ce 100644 --- a/src/qml/Control/ListView/ThumbnailListDelegate.qml +++ b/src/qml/Control/ListView/ThumbnailListDelegate.qml @@ -13,7 +13,7 @@ import org.deepin.dtk 1.0 import Qt5Compat.GraphicalEffects import org.deepin.album 1.0 as Album - +import "ThumbnailListShare.js" as Share import "../" import "../../" import "./" @@ -380,6 +380,11 @@ Item { } mouse.accepted = true + Share.isFaverDoubleClicked = false + } + onDoubleClicked: (mouse)=> { + mouse.accepted = true + Share.isFaverDoubleClicked = true } } } diff --git a/src/qml/Control/ListView/ThumbnailListShare.js b/src/qml/Control/ListView/ThumbnailListShare.js new file mode 100644 index 00000000..9873bd41 --- /dev/null +++ b/src/qml/Control/ListView/ThumbnailListShare.js @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +.pragma library + +var isFaverDoubleClicked = false diff --git a/src/qml/Control/ListView/ThumbnailListViewAlbum.qml b/src/qml/Control/ListView/ThumbnailListViewAlbum.qml index 8a82a26b..f144beca 100644 --- a/src/qml/Control/ListView/ThumbnailListViewAlbum.qml +++ b/src/qml/Control/ListView/ThumbnailListViewAlbum.qml @@ -18,7 +18,7 @@ import "../../PreviewImageViewer" import "../../PreviewImageViewer/Utils" import "ThumbnailListViewTools.js" as ThumbnailTools - +import "ThumbnailListShare.js" as Share FocusScope { id : main @@ -322,12 +322,15 @@ FocusScope { // 单击模式点击/双击模式双击打开图片 if (Qt.styleHints.singleClickActivation || bDbClicked || mouse.source === Qt.MouseEventSynthesizedByQt) { var c = clickedItem.mapToItem(mainStack, 0, 0) - ThumbnailTools.executeViewImage(c.x, c.y, clickedItem.width, clickedItem.height) + console.log(Share.isFaverDoubleClicked) + if (!Share.isFaverDoubleClicked) + ThumbnailTools.executeViewImage(c.x, c.y, clickedItem.width, clickedItem.height) } else { bDbClicked = true; dbClickTimer.interval = Qt.styleHints.mouseDoubleClickInterval; dbClickTimer.start(); + Share.isFaverDoubleClicked = false; } }