fix: avoid quick panel placeholder not aligned to center on startup#1564
Merged
Conversation
wjyrich
previously approved these changes
Apr 22, 2026
把Grid替换为GridLayout来使用布局特性,使托盘上的快捷面板部件内的元素 始终可以居中,避免托盘插件未就绪时,元素偏离中心显示. PMS: BUG-283031 Log:
deepin pr auto review这段代码主要对托盘区域的UI布局进行了调整,涉及尺寸修改和布局容器的替换。以下是对语法逻辑、代码质量、性能和安全的详细审查及改进意见: 1. 语法与逻辑审查
2. 代码质量
3. 性能
4. 安全性
总结与改进建议这段代码的主要问题集中在 建议修改如下: 如果业务逻辑上需要严格保持原来的"横向1行"或"纵向2行"的布局结构,建议显式指定 修改后的代码建议 (针对 PanelTrayItem.qml): contentItem: GridLayout {
// 根据布局方向设置行数或列数,以保持原有逻辑
rows: root.useColumnLayout ? 2 : 1
columns: root.useColumnLayout ? 1 : 2 // 或者根据子元素数量动态设置
// 如果确实希望使用 flow (即不限制行/列数),请保留原代码的 flow
// flow: root.useColumnLayout ? GridLayout.TopToBottom : GridLayout.LeftToRight
rowSpacing: 0
columnSpacing: 0
Loader {
id: placeholder
Layout.alignment: Qt.AlignCenter
Layout.fillHeight: true // 可选:是否填充高度
Layout.fillWidth: true // 可选:是否填充宽度
active: root.shellSurface
visible: active
sourceComponent: TrayItemSurface {
// ...
}
}
Control {
id: quickpanelPlaceholder
Layout.alignment: Qt.AlignCenter
padding: itemMargins
// ...
}
}具体建议:
结论: |
wjyrich
approved these changes
Apr 22, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, wjyrich The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
把Grid替换为GridLayout来使用布局特性,使托盘上的快捷面板部件内的元素始终可以居中,避免托盘插件未就绪时,元素偏离中心显示.