Skip to content

Commit 7ff0055

Browse files
electricfacedeepin-bot[bot]
authored andcommitted
fix(notification): Button text is truncated when hovering over
"Clear all" in English environment with 20 font size - Added OpacityMask to the title container for a smooth fade-out effect on the right side - Enabled gradient effect only when text overflows (using width + 5px threshold) - Made the last 10% of the text fade to transparent for a natural visual transition --- fix(notification): 英文环境且字体为20号,展开通知面板后,鼠标 hover到“清除全部”,此按钮未全部显示。 - 为标题容器添加 OpacityMask 实现右侧平滑淡出 - 仅在文字溢出时启用渐变(宽度 + 5px 阈值) - 最后 10% 文字渐变透明以实现自然视觉过渡 Log: 修复通知中心在英文环境且字体为20号,展开通知面板后,鼠标hover到“清除全部”,此按钮未全部显示问题 Influence: 通知中心-顶部按钮 PMS: BUG-335143
1 parent e1bfe70 commit 7ff0055

1 file changed

Lines changed: 29 additions & 7 deletions

File tree

panels/notification/center/NotifyHeader.qml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import QtQuick
66
import QtQuick.Controls
77
import QtQuick.Layouts
8+
import Qt5Compat.GraphicalEffects
89
import org.deepin.dtk 1.0
910
import org.deepin.ds.notification
1011
import org.deepin.ds.notificationcenter
@@ -45,16 +46,37 @@ FocusScope {
4546

4647
RowLayout {
4748
anchors.fill: parent
48-
NotifyHeaderTitleText {
49-
text: qsTr("Notification Center")
49+
spacing: 8
50+
// Title container with fade-out effect when compressed by buttons
51+
Item {
52+
id: titleContainer
5053
Layout.alignment: Qt.AlignLeft
5154
Layout.leftMargin: 18
52-
tFont: DTK.fontManager.t4
53-
}
54-
55-
Item {
5655
Layout.fillWidth: true
57-
Layout.preferredHeight: 1
56+
implicitHeight: titleText.implicitHeight
57+
58+
// Enable opacity mask only when text overflows container
59+
layer.enabled: titleText.implicitWidth > titleContainer.width + 5
60+
layer.effect: OpacityMask {
61+
maskSource: Rectangle {
62+
width: titleContainer.width
63+
height: titleContainer.height
64+
// Horizontal gradient: fully visible on left, fade to transparent on right
65+
gradient: Gradient {
66+
orientation: Gradient.Horizontal
67+
GradientStop { position: 0.0; color: "#FFFFFFFF" } // Fully opaque
68+
GradientStop { position: 0.9; color: "#FFFFFFFF" } // Still opaque at 90%
69+
GradientStop { position: 1.0; color: "#00FFFFFF" } // Fully transparent
70+
}
71+
}
72+
}
73+
74+
NotifyHeaderTitleText {
75+
id: titleText
76+
text: qsTr("Notification Center")
77+
elide: Text.ElideNone
78+
tFont: DTK.fontManager.t4
79+
}
5880
}
5981

6082
AnimationSettingButton {

0 commit comments

Comments
 (0)