fix: improve dialog sizing and remove unused event filter#697
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom Oct 28, 2025
Merged
fix: improve dialog sizing and remove unused event filter#697deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
Conversation
1. Enhanced dialog width calculation to respect maximum width constraint 2. Added dynamic height calculation based on layout's total height for the given width 3. Removed unused event filter for title and message labels that handled font changes 4. The event filter was unnecessary as Qt's layout system already handles text wrapping properly Influence: 1. Test dialog resizing with various content lengths 2. Verify dialog respects maximum width settings 3. Check that text wrapping works correctly in title and message labels 4. Test dialog appearance with different font sizes 5. Ensure dialog maintains minimum size requirements fix: 改进对话框尺寸计算并移除未使用的事件过滤器 1. 增强对话框宽度计算以遵循最大宽度约束 2. 添加基于布局总高度的动态高度计算 3. 移除用于标题和消息标签字体变化的未使用事件过滤器 4. 该事件过滤器不再必要,因为Qt的布局系统已能正确处理文本换行 Influence: 1. 测试不同内容长度时的对话框调整大小 2. 验证对话框遵循最大宽度设置 3. 检查标题和消息标签中的文本换行是否正确工作 4. 测试不同字体大小下的对话框外观 5. 确保对话框保持最小尺寸要求 PMS: BUG-331061
deepin-ci-robot
added a commit
to linuxdeepin/dtk6widget
that referenced
this pull request
Oct 28, 2025
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#697
Contributor
deepin pr auto review我来对这段代码变更进行详细分析:
第一处修改在 size.setWidth(qMin(q->maximumWidth(), qMax(size.width(), DIALOG::DEFAULT_WIDTH)));
if (auto layout = q->layout()) {
size.setHeight(layout->totalHeightForWidth(size.width()));
}第二处修改删除了
语法逻辑:
代码质量:
代码性能:
代码安全:
void DDialogPrivate::updateSize()
{
if (!q->testAttribute(Qt::WA_Resized)) {
QSize size = q->sizeHint();
// 限制宽度在最大值和默认值之间
size.setWidth(qMin(q->maximumWidth(), qMax(size.width(), DIALOG::DEFAULT_WIDTH)));
// 安全地获取布局并计算高度
if (QLayout *layout = q->layout()) {
size.setHeight(layout->totalHeightForWidth(size.width()));
}
// 确保最小高度
size.setHeight(qMax(size.height(), DIALOG::DEFAULT_HEIGHT));
q->resize(size);
}
}
|
BLumia
approved these changes
Oct 28, 2025
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia 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 |
Contributor
Author
|
/forcemerge |
18202781743
pushed a commit
to linuxdeepin/dtk6widget
that referenced
this pull request
Oct 28, 2025
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#697
Contributor
|
This pr force merged! (status: blocked) |
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.
the given width
font changes
handles text wrapping properly
Influence:
fix: 改进对话框尺寸计算并移除未使用的事件过滤器
Influence:
PMS: BUG-331061