添加标签集中显示区域点击空白处关闭的功能,优化收藏区域显示

This commit is contained in:
qiqi 2023-03-20 15:32:46 +08:00 committed by hewenfei
parent ed7966461c
commit e1cee053cc
2 changed files with 32 additions and 6 deletions

View File

@ -1,3 +1,21 @@
/*
* Copyright (C) 2023, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import org.ukui.menu.core 1.0 import org.ukui.menu.core 1.0
@ -27,6 +45,11 @@ Item {
} }
} }
MouseArea {
anchors.fill: parent
onClicked: viewHide.start();
}
GridView { GridView {
id: selectionArea id: selectionArea
anchors.centerIn: parent anchors.centerIn: parent
@ -56,7 +79,7 @@ Item {
delegate: AppControls2.StyleBackground { delegate: AppControls2.StyleBackground {
height: selectionArea.itemHeight; width: selectionArea.itemWidth height: selectionArea.itemHeight; width: selectionArea.itemWidth
alpha: itemMouseArea.containsPress ? 0.82 : itemMouseArea.containsMouse ? 0.55 : 0.00 alpha: (itemMouseArea.containsPress && !model.isDisable) ? 0.82 : (itemMouseArea.containsMouse && !model.isDisable) ? 0.55 : 0.00
useStyleTransparent: false useStyleTransparent: false
radius: 8 radius: 8
@ -72,14 +95,15 @@ Item {
MouseArea { MouseArea {
id: itemMouseArea id: itemMouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: !model.isDisable
visible: !model.isDisable
onClicked: { onClicked: {
if (!model.isDisable) {
viewHide.start(); viewHide.start();
root.labelSelected(model.id); root.labelSelected(model.id);
} }
} }
} }
} }
}
} }

View File

@ -47,7 +47,9 @@ UkuiMenuExtension {
id: favoriteView id: favoriteView
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 16 anchors.leftMargin: 16
anchors.topMargin: 14 anchors.topMargin: 12
anchors.bottomMargin: 6
clip: true
cellWidth: itemHeight + spacing; cellHeight: cellWidth cellWidth: itemHeight + spacing; cellHeight: cellWidth
property int exchangedStartIndex: 0 property int exchangedStartIndex: 0
property int spacing: 4 property int spacing: 4