feat(taskManager):添加超长滚动功能
This commit is contained in:
parent
71d408b453
commit
29fdceaec1
|
@ -23,6 +23,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import org.ukui.quick.widgets 1.0
|
||||
import org.ukui.quick.items 1.0
|
||||
import org.ukui.quick.platform 1.0
|
||||
import org.ukui.panel.taskManager 1.0 as UkuiTaskManager
|
||||
|
||||
WidgetItem {
|
||||
|
@ -30,10 +31,96 @@ WidgetItem {
|
|||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
UkuiTaskManager.TaskManagerView {
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
}
|
||||
spacing: 5
|
||||
|
||||
// taskManager
|
||||
MouseArea {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
// Layout.margins: 2
|
||||
enabled: taskManagerView.view.contentWidth > taskManagerView.view.width
|
||||
onWheel: (wheel) => {
|
||||
if (wheel.angleDelta.y > 0) {
|
||||
taskManagerView.view.contentX = Math.max(taskManagerView.view.contentX - wheel.angleDelta.y, 0)
|
||||
} else {
|
||||
taskManagerView.view.contentX = Math.min(taskManagerView.view.contentX - wheel.angleDelta.y,
|
||||
taskManagerView.view.contentWidth - taskManagerView.view.width + taskManagerView.view.spacing)
|
||||
}
|
||||
}
|
||||
|
||||
UkuiTaskManager.TaskManagerView {
|
||||
id: taskManagerView
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
// 超长滚动按钮
|
||||
StyleBackground {
|
||||
Layout.preferredHeight: 40
|
||||
Layout.preferredWidth: 80 // TODO
|
||||
Layout.margins: 2
|
||||
|
||||
paletteRole: Theme.Text
|
||||
useStyleTransparency: false
|
||||
alpha: 0.1
|
||||
radius: 12
|
||||
visible: taskManagerView.view.contentWidth > taskManagerView.view.width
|
||||
|
||||
RowLayout {
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
MouseArea {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
onClicked: {
|
||||
taskManagerView.view.contentX = Math.max(taskManagerView.view.contentX - 50, 0)
|
||||
}
|
||||
|
||||
Icon {
|
||||
width: 16; height: width
|
||||
anchors.centerIn: parent
|
||||
mode: {
|
||||
if (taskManagerView.view.contentX === 0) {
|
||||
return Icon.Disabled;
|
||||
} else {
|
||||
return Icon.AutoHighlight;
|
||||
}
|
||||
}
|
||||
source: "ukui-start-symbolic" // TODO
|
||||
}
|
||||
}
|
||||
StyleBackground {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 1
|
||||
paletteRole: Theme.Text
|
||||
useStyleTransparency: false
|
||||
alpha: 0.15
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
onClicked: taskManagerView.view.contentX = Math.min(taskManagerView.view.contentX + 50,
|
||||
taskManagerView.view.contentWidth - taskManagerView.view.width + taskManagerView.view.spacing)
|
||||
|
||||
Icon {
|
||||
width: 16; height: width
|
||||
anchors.centerIn: parent
|
||||
mode: {
|
||||
if (taskManagerView.view.contentX === taskManagerView.view.contentWidth - taskManagerView.view.width + taskManagerView.view.spacing) {
|
||||
return Icon.Disabled;
|
||||
} else {
|
||||
return Icon.AutoHighlight;
|
||||
}
|
||||
}
|
||||
source: "ukui-end-symbolic"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
// init
|
||||
if (Widget.globalConfig.mergeIcons === undefined) {
|
||||
|
|
|
@ -365,7 +365,7 @@ DropArea {
|
|||
// height: parent.height
|
||||
property bool isHorizontal: orientation === ListView.Horizontal
|
||||
property real taskItemSize: isHorizontal ? taskItemView.height : taskItemView.width
|
||||
|
||||
clip: true
|
||||
interactive: false
|
||||
|
||||
spacing: 4
|
||||
|
|
Loading…
Reference in New Issue