Skip to content

Commit bbeb382

Browse files
MyLeeJiEundeepin-bot[bot]
authored andcommitted
fix: add scroll support and fix title bar layout
1. Wrap right content area in a Flickable with vertical ScrollBar to handle overflow when content exceeds dialog height 2. Fix content height calculation to use explicit height instead of implicitHeight for proper layout 3. Hide title bar label when title is empty using a Loader 4. Adjust padding to remove top and right padding for better alignment 5. Add bottom margin to acknowledgements section to prevent content cutoff at the bottom Log: Fix about dialog content overflow by adding scrollable area and correct title bar layout fix: 添加滚动支持并修复标题栏布局 1. 将右侧内容区域包裹在带垂直滚动条的 Flickable 中,解决内容超出 对话框高度时的显示问题 2. 修复内容高度计算,使用显式高度替代 implicitHeight 以确保正确布局 3. 使用 Loader 在标题为空时隐藏标题栏文本 4. 调整内边距,移除顶部和右侧内边距以改善对齐效果 5. 为致谢部分添加底部边距,防止内容在底部被截断 Log: 修复关于对话框内容溢出问题,添加可滚动区域并修正标题栏布局 PMS: BUG-361037
1 parent 9ab9141 commit bbeb382

2 files changed

Lines changed: 104 additions & 81 deletions

File tree

qt6/src/qml/AboutDialog.qml

Lines changed: 95 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import QtQuick
66
import QtQuick.Layouts
7+
import QtQuick.Controls
78
import QtQuick.Window
89
import org.deepin.dtk 1.0 as D
910
import org.deepin.dtk.style 1.0 as DS
@@ -12,6 +13,8 @@ DialogWindow {
1213
id: control
1314
width: DS.Style.aboutDialog.width
1415
height: DS.Style.aboutDialog.height
16+
topPadding: 0
17+
rightPadding: 0
1518

1619
property alias windowTitle: control.title
1720
property alias productName: productNameLabel.text
@@ -30,7 +33,7 @@ DialogWindow {
3033
RowLayout {
3134
id: contentView
3235
width: parent.width
33-
implicitHeight: contentLayout.implicitHeight
36+
height: control.height - DS.Style.dialogWindow.titleBarHeight
3437

3538
D.LicenseInfoProvider {
3639
id: licensePathChecker
@@ -79,94 +82,109 @@ DialogWindow {
7982
visible: control.license !== ""
8083
}
8184
}
82-
ColumnLayout {
85+
Flickable {
86+
id: rightContentView
87+
ScrollBar.vertical: ScrollBar {}
8388
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
84-
spacing: 10
8589
Layout.fillWidth: true
8690
Layout.fillHeight: true
87-
Layout.rightMargin: 20
88-
ColumnLayout {
89-
spacing: 1
90-
Label {
91-
font: D.DTK.fontManager.t10
92-
text: qsTr("Version")
93-
}
94-
Label {
95-
id: versionLabel
96-
font: D.DTK.fontManager.t8
97-
wrapMode: Text.WordWrap
98-
text: Qt.application.version
99-
Layout.fillWidth: true
100-
}
101-
}
102-
ColumnLayout {
103-
spacing: 1
104-
Label {
105-
font: D.DTK.fontManager.t10
106-
text: qsTr("Homepage")
107-
}
108-
Label {
109-
id: websiteLabel
110-
font: D.DTK.fontManager.t8
111-
textFormat: Text.RichText
112-
text: (control.websiteLink === "" || control.websiteName === "") ?
113-
"" : control.__websiteLinkTemplate.arg(websiteLink).arg(control.websiteName)
114-
wrapMode: Text.WordWrap
115-
Layout.fillWidth: true
116-
117-
MouseArea {
118-
anchors.fill: parent
119-
cursorShape: Qt.PointingHandCursor
120-
acceptedButtons: Qt.NoButton
91+
clip: true
92+
contentWidth: width
93+
contentHeight: rightContentLayout.height
94+
boundsBehavior: Flickable.StopAtBounds
95+
flickableDirection: Flickable.VerticalFlick
96+
97+
Item {
98+
ColumnLayout {
99+
id: rightContentLayout
100+
width: rightContentView.width
101+
spacing: 10
102+
103+
ColumnLayout {
104+
spacing: 1
105+
Label {
106+
font: D.DTK.fontManager.t10
107+
text: qsTr("Version")
108+
}
109+
Label {
110+
id: versionLabel
111+
font: D.DTK.fontManager.t8
112+
wrapMode: Text.WordWrap
113+
text: Qt.application.version
114+
Layout.fillWidth: true
115+
}
121116
}
122-
}
123-
}
124-
ColumnLayout {
125-
spacing: 1
126-
Label {
127-
font: D.DTK.fontManager.t10
128-
text: qsTr("Description")
129-
}
130-
Label {
131-
id: descriptionLabel
132-
Layout.fillWidth: true
133-
font: D.DTK.fontManager.t8
134-
wrapMode: Text.WordWrap
135-
elide: Text.ElideRight
136-
}
137-
}
117+
ColumnLayout {
118+
spacing: 1
119+
Label {
120+
font: D.DTK.fontManager.t10
121+
text: qsTr("Homepage")
122+
}
123+
Label {
124+
id: websiteLabel
125+
font: D.DTK.fontManager.t8
126+
textFormat: Text.RichText
127+
text: (control.websiteLink === "" || control.websiteName === "") ?
128+
"" : control.__websiteLinkTemplate.arg(websiteLink).arg(control.websiteName)
129+
wrapMode: Text.WordWrap
130+
Layout.fillWidth: true
138131

139-
ColumnLayout {
140-
spacing: 1
141-
Label {
142-
font: D.DTK.fontManager.t10
143-
text: qsTr("Acknowledgements")
144-
}
145-
Label {
146-
id: acknowledgmentsLabel
147-
text: {
148-
var softwareText = qsTr("open-source software");
149-
if (licensePathChecker.valid)
150-
return qsTr("Sincerely appreciate the %1 used.").arg(control.__websiteLinkTemplate.arg("-").arg(softwareText));
151-
else
152-
return qsTr("Sincerely appreciate the %1 used.").arg(softwareText);
132+
MouseArea {
133+
anchors.fill: parent
134+
cursorShape: Qt.PointingHandCursor
135+
acceptedButtons: Qt.NoButton
136+
}
137+
}
153138
}
154-
textFormat: Text.RichText
155-
Layout.fillWidth: true
156-
font: D.DTK.fontManager.t8
157-
wrapMode: Text.WordWrap
139+
ColumnLayout {
140+
spacing: 1
141+
Label {
142+
font: D.DTK.fontManager.t10
143+
text: qsTr("Description")
144+
}
145+
Label {
146+
id: descriptionLabel
147+
Layout.fillWidth: true
148+
font: D.DTK.fontManager.t8
149+
wrapMode: Text.WordWrap
158150
elide: Text.ElideRight
159-
160-
onLinkActivated: function(link) {
161-
licenseDialogLoader.active = true
151+
}
162152
}
163153

164-
HoverHandler {
165-
cursorShape: acknowledgmentsLabel.hoveredLink !== "" ? Qt.PointingHandCursor : Qt.ArrowCursor
154+
ColumnLayout {
155+
Layout.bottomMargin: 30
156+
spacing: 1
157+
Label {
158+
font: D.DTK.fontManager.t10
159+
text: qsTr("Acknowledgements")
160+
}
161+
Label {
162+
id: acknowledgmentsLabel
163+
text: {
164+
var softwareText = qsTr("open-source software");
165+
if (licensePathChecker.valid)
166+
return qsTr("Sincerely appreciate the %1 used.").arg(control.__websiteLinkTemplate.arg("-").arg(softwareText));
167+
else
168+
return qsTr("Sincerely appreciate the %1 used.").arg(softwareText);
169+
}
170+
textFormat: Text.RichText
171+
Layout.fillWidth: true
172+
font: D.DTK.fontManager.t8
173+
wrapMode: Text.WordWrap
174+
elide: Text.ElideRight
175+
176+
onLinkActivated: function(link) {
177+
licenseDialogLoader.active = true
178+
}
179+
180+
HoverHandler {
181+
cursorShape: acknowledgmentsLabel.hoveredLink !== "" ? Qt.PointingHandCursor : Qt.ArrowCursor
182+
}
183+
}
166184
}
167185
}
168186
}
169-
}
187+
}
170188

171189
Component.onCompleted: {
172190
websiteLabel.linkActivated.connect(D.ApplicationHelper.openUrl)

qt6/src/qml/DialogWindow.qml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,17 @@ Window {
6666
}
6767
}
6868

69-
D.Label {
70-
text: control.title
69+
Loader {
70+
active: title !== ""
7171
Layout.fillWidth: true
7272
Layout.alignment: Qt.AlignHCenter
73-
elide: Text.ElideRight
74-
horizontalAlignment: Text.AlignHCenter
73+
sourceComponent: Component {
74+
D.Label {
75+
text: control.title
76+
elide: Text.ElideRight
77+
horizontalAlignment: Text.AlignHCenter
78+
}
79+
}
7580
}
7681

7782
Item {

0 commit comments

Comments
 (0)