fix(views): adaptive width layout for remote management#533
Conversation
Remove hardcoded width values and use dynamic width calculation to support adaptive layout in remote management panel. 移除硬编码宽度值,使用动态宽度计算,支持远程管理面板自适应布局。 Log: 修复远程管理面板布局自适应问题 PMS: BUG-361273 Influence: 修复后界面元素能够根据容器大小自适应宽度,提升不同分辨率下的显示效果。
91f59e6 to
1563174
Compare
deepin pr auto review你好!我是CodeGeex,很高兴为你审查这段代码。 整体来看,这次代码变更的核心目的是将UI控件从固定尺寸/硬编码尺寸改为动态自适应尺寸。你移除了大量如 不过,在语法逻辑、代码质量和性能方面,还有一些值得注意和优化的细节。以下是我的审查意见: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
综合修改建议代码片段针对 void FocusFrame::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
// 开启抗锯齿
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
DPalette pa = DGuiApplicationHelper::instance()->applicationPalette();
if (hasFocus()) {
// qCDebug(views) << "Branch: Focus is active";
// 边框:使用 adjusted 更加安全且语义清晰
QPainterPath FramePath;
paintRoundedRect(FramePath, rect().adjusted(2, 2, -2, -2));
// 获取活动色
QPen pen(pa.color(DPalette::Highlight), 2);
painter.setPen(pen);
painter.drawPath(FramePath);
// 绘制背景
QPainterPath itemBackgroundPath;
paintRoundedRect(itemBackgroundPath, rect().adjusted(4, 4, -4, -4));
// ui要有框,背景不变
painter.fillPath(itemBackgroundPath, QBrush(pa.color(DPalette::ItemBackground)));
} else {
// 焦点不在,不绘制边框,仅绘制背景
QPainterPath itemBackgroundPath;
paintRoundedRect(itemBackgroundPath, rect()); // rect() 本身就是控件完整尺寸
// ui要有框,背景不变
painter.fillPath(itemBackgroundPath, QBrush(pa.color(DPalette::ItemBackground)));
}
}对于 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind 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 |
|
/merge |
Remove hardcoded width values and use dynamic width calculation to support adaptive layout in remote management panel.
移除硬编码宽度值,使用动态宽度计算,支持远程管理面板自适应布局。
Log: 修复远程管理面板布局自适应问题
PMS: BUG-361273
Influence: 修复后界面元素能够根据容器大小自适应宽度,提升不同分辨率下的显示效果。