fix(qml):添加应用组展开状态下的编辑模式
This commit is contained in:
parent
37a1773519
commit
67d9b21beb
|
@ -2,6 +2,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls 2.5
|
||||
import org.ukui.menu.core 1.0
|
||||
import "../extensions" as Extension
|
||||
import org.ukui.quick.platform 1.0 as Platform
|
||||
import org.ukui.quick.items 1.0 as UkuiItems
|
||||
|
||||
|
@ -44,9 +45,7 @@ MouseArea {
|
|||
spacing: 12
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: tag
|
||||
visible: mainWindow.editMode
|
||||
Extension.EditModeFlag {
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
@ -54,26 +53,10 @@ MouseArea {
|
|||
Layout.maximumHeight: width
|
||||
Layout.rightMargin: visible ? 4 : 0
|
||||
|
||||
Component {
|
||||
id: editImage
|
||||
UkuiItems.Button {
|
||||
width: 28
|
||||
height: 28
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
background.paletteRole: Platform.Theme.Light
|
||||
background.alpha: 1
|
||||
activeFocusOnTab: false
|
||||
|
||||
isFavorited: favorite
|
||||
onClicked: {
|
||||
appManager.changeFavoriteState(id, favorite);
|
||||
}
|
||||
|
||||
background.radius: width / 2
|
||||
icon.source: favorite ? "ukui-cancel-star-symbolic" : "non-starred-symbolic"
|
||||
}
|
||||
}
|
||||
sourceComponent: mainWindow.editMode ? editImage : null
|
||||
appManager.changeFavoriteState(id, !isFavorited);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,33 +114,15 @@ ListView {
|
|||
}
|
||||
|
||||
// 收藏按钮
|
||||
Loader {
|
||||
property bool isFavorited: model.favorite > 0
|
||||
Extension.EditModeFlag {
|
||||
isFavorited: model.favorite > 0
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 28
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
|
||||
active: mainWindow.editMode
|
||||
sourceComponent: Component {
|
||||
UkuiItems.Button {
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
background.paletteRole: Platform.Theme.Light
|
||||
background.alpha: 1
|
||||
activeFocusOnTab: false
|
||||
|
||||
onClicked: {
|
||||
appManager.changeFavoriteState(id, !isFavorited);
|
||||
}
|
||||
|
||||
background.radius: width / 2
|
||||
icon.source: isFavorited ? "ukui-cancel-star-symbolic" : "non-starred-symbolic"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -305,6 +287,7 @@ ListView {
|
|||
//编辑模式标志
|
||||
Extension.EditModeFlag {
|
||||
id: tag
|
||||
isFavorited: true
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
anchors.right: parent.right
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.ukui.quick.platform 1.0 as Platform
|
|||
|
||||
Loader {
|
||||
id: tag
|
||||
property bool isFavorited
|
||||
signal clicked()
|
||||
|
||||
Component {
|
||||
|
@ -21,7 +22,7 @@ Loader {
|
|||
onClicked: tag.clicked()
|
||||
|
||||
background.radius: width / 2
|
||||
icon.source: "ukui-cancel-star-symbolic"
|
||||
icon.source: isFavorited ? "ukui-cancel-star-symbolic" : "non-starred-symbolic"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,11 @@ UkuiMenuExtension {
|
|||
} else {
|
||||
if (mainWindow.editMode) {
|
||||
mainWindow.editMode = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
folderLoader.isFolderOpened = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UkuiItems.Menu {
|
||||
id: menu
|
||||
|
|
|
@ -156,7 +156,7 @@ GridView {
|
|||
|
||||
//编辑模式标志
|
||||
EditModeFlag {
|
||||
id: tag
|
||||
isFavorited: true
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 10
|
||||
|
|
|
@ -172,6 +172,16 @@ SwipeView {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditModeFlag {
|
||||
isFavorited: true
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 10
|
||||
onClicked: {
|
||||
extensionData.favoriteAppsModel.removeAppFromFavorites(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue