feat(qml):添加全屏编辑模式
This commit is contained in:
parent
f36b16229e
commit
2bb585b4ab
|
@ -103,9 +103,10 @@ ListView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header: Item {
|
header: MouseArea {
|
||||||
width: root.width
|
width: root.width
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
|
||||||
property var widgets: []
|
property var widgets: []
|
||||||
property var widgetInfos: []
|
property var widgetInfos: []
|
||||||
|
@ -116,6 +117,40 @@ ListView {
|
||||||
widgets.push("favorite");
|
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 {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: childrenRect.height + spacing
|
height: childrenRect.height + spacing
|
||||||
|
@ -155,12 +190,25 @@ ListView {
|
||||||
delegateLayout.anchors.bottomMargin: 16
|
delegateLayout.anchors.bottomMargin: 16
|
||||||
delegateLayout.spacing: 8
|
delegateLayout.spacing: 8
|
||||||
mergePrompt.anchors.topMargin: 10
|
mergePrompt.anchors.topMargin: 10
|
||||||
mergePrompt.width: width*0.67
|
mergePrompt.width: width*0.675
|
||||||
|
// mergePrompt.width: 108
|
||||||
mergePrompt.radius: 32
|
mergePrompt.radius: 32
|
||||||
|
|
||||||
Component.onCompleted: contentShowFinished.connect(resetOpacity)
|
Component.onCompleted: contentShowFinished.connect(resetOpacity)
|
||||||
Component.onDestruction: contentShowFinished.disconnect(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,6 +15,9 @@ UkuiItems.StyleBackground {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (mainWindow.editMode) {
|
||||||
|
mainWindow.editMode = false;
|
||||||
|
} else {
|
||||||
if (mainContainer.visible) {
|
if (mainContainer.visible) {
|
||||||
//执行全屏退出操作
|
//执行全屏退出操作
|
||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
|
@ -24,6 +27,7 @@ UkuiItems.StyleBackground {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Extension.FullScreenFolder {
|
Extension.FullScreenFolder {
|
||||||
id: folderLoader
|
id: folderLoader
|
||||||
|
|
|
@ -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.fill: parent
|
||||||
anchors.topMargin: 8
|
anchors.topMargin: 8
|
||||||
anchors.bottomMargin: 14
|
anchors.bottomMargin: 14
|
||||||
spacing: 6
|
spacing: 4
|
||||||
|
|
||||||
ToolTip.visible: iconText.truncated && control.containsMouse
|
ToolTip.visible: iconText.truncated && control.containsMouse
|
||||||
ToolTip.text: model.name
|
ToolTip.text: model.name
|
||||||
|
|
|
@ -135,39 +135,22 @@ GridView {
|
||||||
mergePrompt.anchors.topMargin: 6
|
mergePrompt.anchors.topMargin: 6
|
||||||
mergePrompt.width: 52
|
mergePrompt.width: 52
|
||||||
mergePrompt.radius: 14
|
mergePrompt.radius: 14
|
||||||
|
delegateLayout.anchors.leftMargin: 2
|
||||||
|
delegateLayout.anchors.rightMargin: 2
|
||||||
|
|
||||||
Component.onCompleted: favoriteView.contentShowFinished.connect(resetOpacity)
|
Component.onCompleted: favoriteView.contentShowFinished.connect(resetOpacity)
|
||||||
Component.onDestruction: favoriteView.contentShowFinished.disconnect(resetOpacity)
|
Component.onDestruction: favoriteView.contentShowFinished.disconnect(resetOpacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//编辑模式标志
|
//编辑模式标志
|
||||||
Loader {
|
EditModeFlag {
|
||||||
id: tag
|
id: tag
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 10
|
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: {
|
onClicked: {
|
||||||
visualModel.model.removeAppFromFavorites(id);
|
visualModel.model.removeAppFromFavorites(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
background.radius: width / 2
|
|
||||||
icon.source: "ukui-cancel-star-symbolic"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceComponent: mainWindow.editMode && (type === DataType.Normal) ? editImage : null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ SwipeView {
|
||||||
property var folderContentModel
|
property var folderContentModel
|
||||||
property alias folderSwipeView: folderSwipeView
|
property alias folderSwipeView: folderSwipeView
|
||||||
property bool mouseEnable: false
|
property bool mouseEnable: false
|
||||||
property int contentMargins
|
property real contentMargins
|
||||||
property int labelMagrins
|
property real labelMagrins
|
||||||
property int labelSpacing
|
property real labelSpacing
|
||||||
property bool isFullScreen: false
|
property bool isFullScreen: false
|
||||||
|
|
||||||
function hideFolder() {
|
function hideFolder() {
|
||||||
|
@ -135,8 +135,8 @@ SwipeView {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: labelSpacing
|
anchors.margins: labelMagrins
|
||||||
spacing: (parent.width > 40) ? 4 : 0
|
spacing: labelSpacing
|
||||||
UkuiItems.Icon {
|
UkuiItems.Icon {
|
||||||
id: iconImage
|
id: iconImage
|
||||||
source: icon
|
source: icon
|
||||||
|
|
|
@ -81,8 +81,8 @@ Loader {
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: content
|
target: content
|
||||||
contentMargins: 0
|
contentMargins: 0
|
||||||
labelSpacing: 8
|
labelSpacing: 2
|
||||||
labelMagrins: 2
|
labelMagrins: 4
|
||||||
}
|
}
|
||||||
PropertyChanges { target: folderNameText; opacity: 1 }
|
PropertyChanges { target: folderNameText; opacity: 1 }
|
||||||
},
|
},
|
||||||
|
@ -122,7 +122,7 @@ Loader {
|
||||||
}
|
}
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
duration: animationDuration; easing.type: Easing.OutQuint
|
duration: animationDuration; easing.type: Easing.OutQuint
|
||||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScriptAction { script: content.folderSwipeView.hideFolder() }
|
ScriptAction { script: content.folderSwipeView.hideFolder() }
|
||||||
|
@ -142,7 +142,7 @@ Loader {
|
||||||
}
|
}
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
duration: animationDuration; easing.type: Easing.OutQuint
|
duration: animationDuration; easing.type: Easing.OutQuint
|
||||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScriptAction {
|
ScriptAction {
|
||||||
|
|
|
@ -121,7 +121,7 @@ Loader {
|
||||||
}
|
}
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
duration: animationDuration; easing.type: Easing.OutQuint
|
duration: animationDuration; easing.type: Easing.OutQuint
|
||||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScriptAction { script: content.folderSwipeView.hideFolder() }
|
ScriptAction { script: content.folderSwipeView.hideFolder() }
|
||||||
|
@ -141,7 +141,7 @@ Loader {
|
||||||
}
|
}
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
duration: animationDuration; easing.type: Easing.OutQuint
|
duration: animationDuration; easing.type: Easing.OutQuint
|
||||||
properties: "contentMargins, labelMagrins, labelSpacing"
|
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScriptAction {
|
ScriptAction {
|
||||||
|
|
|
@ -39,5 +39,6 @@
|
||||||
<file>AppUI/FullScreenAppList.qml</file>
|
<file>AppUI/FullScreenAppList.qml</file>
|
||||||
<file>AppUI/FullScreenAppItem.qml</file>
|
<file>AppUI/FullScreenAppItem.qml</file>
|
||||||
<file>AppUI/AppLabelPage.qml</file>
|
<file>AppUI/AppLabelPage.qml</file>
|
||||||
|
<file>extensions/EditModeFlag.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Reference in New Issue