Skip to content

Commit ffa2eb0

Browse files
committed
feat: add hover background and adjust spacing for dock app items
1. Added AppletItemBackground component to AppItem.qml for visual feedback on hover and active states 2. Introduced appTitleSpaceing property to control spacing between icon and title 3. Updated implicitWidth calculation to use appTitleSpaceing instead of fixed value 4. Added hoverHandler ID to HoverHandler for background control 5. Added new properties in TaskManager.qml for consistent spacing calculations 6. Modified appContainer spacing to adjust based on textCalculator state 7. Updated textcalculator.cpp to include appTitleSpacing in width calculations 8. Implemented smooth opacity transitions for hover background Log: Added hover effect and improved spacing for dock application items Influence: 1. Test hover effects on dock app items with and without titles 2. Verify spacing between icons and titles in different display modes 3. Check background appearance during hover, press, and active states 4. Test with both light and dark themes 5. Verify smooth opacity transitions 6. Test with multiple apps in dock to ensure consistent spacing 7. Check behavior when dragging app items feat: 为任务栏应用项添加悬停背景并调整间距 1. 在 AppItem.qml 中添加 AppletItemBackground 组件,为悬停和活动状态提供 视觉反馈 2. 引入 appTitleSpaceing 属性以控制图标和标题之间的间距 3. 更新 implicitWidth 计算以使用 appTitleSpaceing 替代固定值 4. 为 HoverHandler 添加 hoverHandler ID 以控制背景 5. 在 TaskManager.qml 中添加新属性以实现一致的间距计算 6. 修改 appContainer 间距以根据 textCalculator 状态进行调整 7. 更新 textcalculator.cpp 以在宽度计算中包含 appTitleSpacing 8. 为悬停背景实现平滑的不透明度过渡效果 Log: 新增任务栏应用项悬停效果并优化间距显示 Influence: 1. 测试带标题和不带标题的任务栏应用项悬停效果 2. 验证不同显示模式下图标和标题之间的间距 3. 检查悬停、按下和活动状态下的背景外观 4. 测试浅色和深色主题下的显示效果 5. 验证平滑的不透明度过渡效果 6. 测试多个应用在任务栏中的间距一致性 7. 检查拖拽应用项时的行为表现 PMS: TASK-384101
1 parent 3db223c commit ffa2eb0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

panels/dock/taskmanager/package/AppItem.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Item {
4242
property int iconSize: Panel.rootObject.dockItemMaxSize * 9 / 14
4343
property bool enableTitle: false
4444
property bool titleActive: enableTitle && titleLoader.active
45-
45+
property int appTitleSpacing: 0
4646
property var iconGlobalPoint: {
4747
var a = icon
4848
var x = 0, y = 0
@@ -79,7 +79,7 @@ Item {
7979
Control {
8080
anchors.fill: parent
8181
id: appItem
82-
implicitWidth: root.titleActive ? (iconContainer.width + 4 + titleLoader.width) : iconContainer.width
82+
implicitWidth: root.titleActive ? (iconContainer.width + titleLoader.width + root.appTitleSpacing) : iconContainer.width
8383
visible: !root.Drag.active // When in dragging, hide app item
8484

8585
Item {
@@ -273,6 +273,7 @@ Item {
273273
}
274274

275275
HoverHandler {
276+
id: hoverHandler
276277
onHoveredChanged: function () {
277278
if (hovered) {
278279
root.onEntered()

panels/dock/taskmanager/package/TaskManager.qml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ ContainmentItem {
1616
property int dockOrder: 16
1717
property real remainingSpacesForTaskManager: Panel.itemAlignment === Dock.LeftAlignment ? Panel.rootObject.dockLeftSpaceForCenter : Panel.rootObject.dockRemainingSpaceForCenter
1818

19+
readonly property int appItemIconSize: Math.round(Panel.rootObject.dockItemMaxSize * 9 / 14)
20+
readonly property int appItemCellWidth: Math.round(Panel.rootObject.dockItemMaxSize * 0.8)
21+
readonly property int appItemSpacing: Math.max(0, Math.max(10, Math.round(appItemIconSize / 3)) - Math.max(0, appItemCellWidth - appItemIconSize))
22+
readonly property int appTitleSpacing: Math.max(10, appItemIconSize / 3)
1923
property real remainingSpacesForSplitWindow: Panel.rootObject.dockLeftSpaceForCenter - (
2024
(Panel.rootObject.dockCenterPartCount - 1) * (visualModel.cellWidth + appContainer.spacing) + (Panel.rootObject.dockCenterPartCount) * Panel.rootObject.dockPartSpacing)
2125
// 用于居中计算的实际应用区域尺寸
@@ -73,7 +77,7 @@ ContainmentItem {
7377
id: appContainer
7478
anchors.fill: parent
7579
useColumnLayout: taskmanager.useColumnLayout
76-
spacing: Panel.rootObject.itemSpacing + visualModel.count % 2
80+
spacing: taskmanager.appItemSpacing
7781
remove: Transition {
7882
NumberAnimation {
7983
properties: "scale,opacity"
@@ -173,6 +177,7 @@ ContainmentItem {
173177
blendOpacity: taskmanager.blendOpacity
174178
title: delegateRoot.title
175179
enableTitle: textCalculator.enabled
180+
appTitleSpacing: taskmanager.appTitleSpacing
176181
ListView.delayRemove: Drag.active
177182
Component.onCompleted: {
178183
dropFilesOnItem.connect(taskmanager.Applet.dropFilesOnItem)

0 commit comments

Comments
 (0)