Skip to content

Commit 9b29be7

Browse files
committed
style: improve TitleBar layout implementation
1. Changed `implicitHeight` to `height` for more explicit sizing control 2. Modified background and content layouts to use explicit width/height instead of anchors.fill 3. These changes provide better layout consistency and prevent potential anchoring issues 4. The visibility logic remains the same but is now more clearly implemented style: 改进 TitleBar 布局实现 1. 将 `implicitHeight` 改为 `height` 以获得更明确的尺寸控制 2. 修改背景和内容布局使用显式宽高而非 anchors.fill 3. 这些改动提供了更好的布局一致性并防止潜在的锚定问题 4. 可见性逻辑保持不变但实现更清晰
1 parent 5b377a9 commit 9b29be7

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

qt6/src/qml/TitleBar.qml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ Item {
1212
id: control
1313
z: D.DTK.TopOrder
1414
width: Window.window.width
15-
// it's binding `height` instead of `visible` property,
16-
// because MouseArea should accept event keeping visible.
17-
implicitHeight: (!__isFullScreen || __isVisible) ? DS.Style.titleBar.height : 1
15+
height: (!__isFullScreen || __isVisible) ? DS.Style.titleBar.height : 1
1816

1917
property string title: Window.window.title
2018
property alias icon: iconLabel
@@ -75,15 +73,16 @@ Item {
7573
Loader {
7674
id: background
7775
active: false
78-
anchors.fill: parent
76+
width: control.width
77+
height: control.height
7978
sourceComponent: D.InWindowBlur {
8079
}
8180
}
8281

8382
ColumnLayout {
84-
id: content
8583
spacing: 0
86-
anchors.fill: parent
84+
width: control.width
85+
height: control.height
8786
visible: control.height > 1
8887

8988
Loader {

0 commit comments

Comments
 (0)