feat(qml):添加全屏编辑模式
This commit is contained in:
parent
f36b16229e
commit
2bb585b4ab
|
@ -103,9 +103,10 @@ ListView {
|
|||
}
|
||||
}
|
||||
|
||||
header: Item {
|
||||
header: MouseArea {
|
||||
width: root.width
|
||||
height: childrenRect.height
|
||||
acceptedButtons: Qt.RightButton
|
||||
|
||||
property var widgets: []
|
||||
property var widgetInfos: []
|
||||
|
@ -116,6 +117,40 @@ ListView {
|
|||
widgets.push("favorite");
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
menu.open();
|
||||
}
|
||||
}
|
||||
|
||||
UkuiItems.Menu {
|
||||
id: menu
|
||||
content: [
|
||||
UkuiItems.MenuItem {
|
||||
text: qsTr("Enable editing mode")
|
||||
onClicked: mainWindow.editMode = true;
|
||||
},
|
||||
UkuiItems.MenuItem {
|
||||
text: qsTr("Remove all favorite apps")
|
||||
onClicked: extensionData.favoriteAppsModel.clearFavorites();
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
// 拖动到文件到空白区域 添加到收藏
|
||||
DropArea {
|
||||
width: parent.width
|
||||
height: favoriteView.contentHeight
|
||||
onEntered: {
|
||||
if (drag.source.isFavorite) {
|
||||
favoriteView.dragTypeIsMerge = false;
|
||||
} else {
|
||||
var id = drag.source.id;
|
||||
extensionData.favoriteAppsModel.addAppToFavorites(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
height: childrenRect.height + spacing
|
||||
|
@ -155,12 +190,25 @@ ListView {
|
|||
delegateLayout.anchors.bottomMargin: 16
|
||||
delegateLayout.spacing: 8
|
||||
mergePrompt.anchors.topMargin: 10
|
||||
mergePrompt.width: width*0.67
|
||||
mergePrompt.width: width*0.675
|
||||
// mergePrompt.width: 108
|
||||
mergePrompt.radius: 32
|
||||
|
||||
Component.onCompleted: contentShowFinished.connect(resetOpacity)
|
||||
Component.onDestruction: contentShowFinished.disconnect(resetOpacity)
|
||||
}
|
||||
|
||||
//编辑模式标志
|
||||
Extension.EditModeFlag {
|
||||
id: tag
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 28
|
||||
onClicked: {
|
||||
visualModel.model.removeAppFromFavorites(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,16 @@ UkuiItems.StyleBackground {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (mainContainer.visible) {
|
||||
//执行全屏退出操作
|
||||
forceActiveFocus();
|
||||
mainWindow.hide();
|
||||
if (mainWindow.editMode) {
|
||||
mainWindow.editMode = false;
|
||||
} else {
|
||||
folderLoader.isFolderOpened = false;
|
||||
if (mainContainer.visible) {
|
||||
//执行全屏退出操作
|
||||
forceActiveFocus();
|
||||
mainWindow.hide();
|
||||
} else {
|
||||
folderLoader.isFolderOpened = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import QtQuick 2.15
|
||||
import org.ukui.menu.core 1.0
|
||||
import org.ukui.quick.items 1.0 as UkuiItems
|
||||
import org.ukui.quick.platform 1.0 as Platform
|
||||
|
||||
Loader {
|
||||
id: tag
|
||||
signal clicked()
|
||||
|
||||
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
|
||||
|
||||
onClicked: tag.clicked()
|
||||
|
||||
background.radius: width / 2
|
||||
icon.source: "ukui-cancel-star-symbolic"
|
||||
}
|
||||
}
|
||||
|
||||
sourceComponent: mainWindow.editMode && (type === DataType.Normal) ? editImage : null
|
||||
}
|
|
@ -104,7 +104,7 @@ UkuiItems.StyleBackground {
|
|||
anchors.fill: parent
|
||||
anchors.topMargin: 8
|
||||
anchors.bottomMargin: 14
|
||||
spacing: 6
|
||||
spacing: 4
|
||||
|
||||
ToolTip.visible: iconText.truncated && control.containsMouse
|
||||
ToolTip.text: model.name
|
||||
|
|
|
@ -135,39 +135,22 @@ GridView {
|
|||
mergePrompt.anchors.topMargin: 6
|
||||
mergePrompt.width: 52
|
||||
mergePrompt.radius: 14
|
||||
delegateLayout.anchors.leftMargin: 2
|
||||
delegateLayout.anchors.rightMargin: 2
|
||||
|
||||
Component.onCompleted: favoriteView.contentShowFinished.connect(resetOpacity)
|
||||
Component.onDestruction: favoriteView.contentShowFinished.disconnect(resetOpacity)
|
||||
}
|
||||
|
||||
|
||||
//编辑模式标志
|
||||
Loader {
|
||||
EditModeFlag {
|
||||
id: tag
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 10
|
||||
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
|
||||
|
||||
onClicked: {
|
||||
visualModel.model.removeAppFromFavorites(id);
|
||||
}
|
||||
|
||||
background.radius: width / 2
|
||||
icon.source: "ukui-cancel-star-symbolic"
|
||||
}
|
||||
onClicked: {
|
||||
visualModel.model.removeAppFromFavorites(id);
|
||||
}
|
||||
|
||||
sourceComponent: mainWindow.editMode && (type === DataType.Normal) ? editImage : null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ SwipeView {
|
|||
property var folderContentModel
|
||||
property alias folderSwipeView: folderSwipeView
|
||||
property bool mouseEnable: false
|
||||
property int contentMargins
|
||||
property int labelMagrins
|
||||
property int labelSpacing
|
||||
property real contentMargins
|
||||
property real labelMagrins
|
||||
property real labelSpacing
|
||||
property bool isFullScreen: false
|
||||
|
||||
function hideFolder() {
|
||||
|
@ -135,8 +135,8 @@ SwipeView {
|
|||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: labelSpacing
|
||||
spacing: (parent.width > 40) ? 4 : 0
|
||||
anchors.margins: labelMagrins
|
||||
spacing: labelSpacing
|
||||
UkuiItems.Icon {
|
||||
id: iconImage
|
||||
source: icon
|
||||
|
|
|
@ -81,8 +81,8 @@ Loader {
|
|||
PropertyChanges {
|
||||
target: content
|
||||
contentMargins: 0
|
||||
labelSpacing: 8
|
||||
labelMagrins: 2
|
||||
labelSpacing: 2
|
||||
labelMagrins: 4
|
||||
}
|
||||
PropertyChanges { target: folderNameText; opacity: 1 }
|
||||
},
|
||||
|
@ -122,7 +122,7 @@ Loader {
|
|||
}
|
||||
PropertyAnimation {
|
||||
duration: animationDuration; easing.type: Easing.OutQuint
|
||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
||||
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||
}
|
||||
}
|
||||
ScriptAction { script: content.folderSwipeView.hideFolder() }
|
||||
|
@ -142,7 +142,7 @@ Loader {
|
|||
}
|
||||
PropertyAnimation {
|
||||
duration: animationDuration; easing.type: Easing.OutQuint
|
||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
||||
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||
}
|
||||
}
|
||||
ScriptAction {
|
||||
|
|
|
@ -121,7 +121,7 @@ Loader {
|
|||
}
|
||||
PropertyAnimation {
|
||||
duration: animationDuration; easing.type: Easing.OutQuint
|
||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
||||
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||
}
|
||||
}
|
||||
ScriptAction { script: content.folderSwipeView.hideFolder() }
|
||||
|
@ -141,7 +141,7 @@ Loader {
|
|||
}
|
||||
PropertyAnimation {
|
||||
duration: animationDuration; easing.type: Easing.OutQuint
|
||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
||||
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||
}
|
||||
}
|
||||
ScriptAction {
|
||||
|
|
|
@ -39,5 +39,6 @@
|
|||
<file>AppUI/FullScreenAppList.qml</file>
|
||||
<file>AppUI/FullScreenAppItem.qml</file>
|
||||
<file>AppUI/AppLabelPage.qml</file>
|
||||
<file>extensions/EditModeFlag.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in New Issue