fix: remove symbol preprocessing and fix list delegate rect#314
Conversation
1. Remove calls to searchHelper->tropeInputSymbol() in file and OCR search, using original user input directly 2. In file search, change info.keyword from regex pattern to original content to avoid filtering 3. Move clearing of text/icon from paint() to initStyleOption() in list delegate for proper state drawing 4. Adjust viewOption rect by -10px right margin before painting select state to prevent clipping 5. Minor code formatting cleanup Log: Improved keyword matching accuracy; fixed list item display under select state Influence: 1. Test file search with various input symbols (Chinese/English brackets, spaces, etc.) 2. Verify OCR search results with special characters 3. Check list item appearance when selected – text and icon should not be cut off 4. Confirm delegate paint behavior with different view styles 5. Ensure right margin is consistent and select state highlight is correctly aligned fix: 移除符号预处理并修复列表代理绘制区域 1. 移除文件和OCR搜索中对searchHelper->tropeInputSymbol()的调用,直接使用 原始用户输入 2. 文件搜索中,将info.keyword从正则表达式改为原始内容,避免不必要的过滤 3. 将清空文本和图标的操作从paint()移到initStyleOption()中,确保选中状态 绘制正确 4. 在绘制选中状态前,将viewOption的右边距增加10px,防止内容被裁剪 5. 清理部分代码格式 Log: 改进的关键词匹配准确性;修复选中状态下列表项显示问题 Influence: 1. 测试文件搜索,输入各种符号(中英文括号、空格等) 2. 验证OCR搜索带有特殊字符的结果 3. 检查列表项选中时的显示效果——文本和图标不应被裁剪 4. 确认不同视图样式下委托绘制行为正常 5. 验证右边距一致,选中状态高亮正确对齐 BUG: https://pms.uniontech.com/bug-view-363989.html
1. Replace global item ToolTipRole with per-region tooltip detection 2. Add TooltipRegion struct to record omitted text bounding rect and full content 3. Cache omitted regions per row in m_tooltipRegionCache 4. Update paint to clear row cache, and record regions when drawing elided name, context, or tail text 5. Modify helpEvent to check if mouse is over any omitted region; show tooltip only there, otherwise hide 6. Remove old ToolTipRole setting in GrandSearchListView::setData to let delegate handle it 7. Change tail text elision from ElideLeft to ElideMiddle for better readability 8. Expose clearTooltipCache() to reset cache when list is cleared Log: Optimized tooltip display: now tooltips appear only when hovering over truncated text areas (file name, match context, tail text), providing a cleaner view. Influence: 1. Verify tooltip appears correctly when mouse hovers over truncated file name, context, or tail text 2. Verify tooltip does not appear when hovering over non-truncated areas 3. Test tooltip disappearance when moving mouse away from truncated area 4. Verify tail text shows middle ellipsis correctly (e.g., long paths) 5. Test list clear and reload to ensure tooltip cache is cleared properly 6. Verify no regression in general list rendering and interaction feat: 优化tooltip仅在省略文本区域显示 1. 用逐区域tooltip检测替代全局item的ToolTipRole 2. 添加TooltipRegion结构体,记录省略文本的绘制矩形和完整内容 3. 按行缓存省略区域到m_tooltipRegionCache 4. 在paint中清空行缓存,并在绘制省略的文件名、摘要或拖尾文本时记录区域 5. 修改helpEvent,检查鼠标是否位于任意省略区域内;仅在区域内显示 tooltip,否则隐藏 6. 移除GrandSearchListView::setData中旧的ToolTipRole设置,交由delegate 处理 7. 将拖尾文本省略方向从ElideLeft改为ElideMiddle,提升可读性 8. 提供clearTooltipCache()方法,在列表清空时重置缓存 Log: 优化tooltip显示:现在仅在悬停在被截断的文本区域(文件名、摘要、拖 尾)时才出现提示,界面更简洁 Influence: 1. 验证鼠标悬停在截断的文件名、摘要或拖尾文本上时正确显示tooltip 2. 验证鼠标在非截断区域时不显示tooltip 3. 测试鼠标移出截断区域后tooltip消失 4. 验证拖尾文本中间省略显示是否正确(如长路径) 5. 测试清空并重新加载列表,确保tooltip缓存正确清除 6. 验证列表整体渲染和交互无回归问题 BUG: https://pms.uniontech.com/bug-view-364065.html
deepin pr auto review你好!我是CodeGeeX,你的智能编程助手。我已经仔细审查了你提供的Git Diff。本次代码变更主要涉及两个方面:一是搜索关键词处理逻辑的简化(去除了 以下是我对语法逻辑、代码质量、代码性能和代码安全方面的详细审查意见及改进建议: 1. 语法与逻辑1.1 关键词正则转纯文本匹配的潜在逻辑风险
1.2 Tooltip区域坐标系不一致导致错位
1.3
2. 代码质量2.1 Tooltip 换行逻辑硬编码
2.2 省略号策略变更 (
2.3
3. 代码性能3.1
3.2 JSON 解析性能(OCR模块)
4. 代码安全4.1 去除
4.2 Tooltip 内容的富文本注入
总结与修改建议代码片段针对最严重的 Tooltip 坐标错位问题 和 缓存累积问题,建议进行如下修正: 1. 修正 Tooltip 区域的坐标记录(以 // 记录时,rect 必须是相对于整个 Item (option.rect) 的坐标
if (elidedName != name) {
// drawRect 目前的坐标是基于 textStartX 和 startY 的,需转换为 Item 相对坐标
// 假设 textStartX 和 startY 已经是相对 option.rect 的偏移量,则无需修改
// 但如果 startY 是绝对坐标,需要减去 option.rect.y()
QRect itemRelativeRect(drawRect.x(), drawRect.y() - option.rect.y(), drawRect.width(), drawRect.height());
recordTooltipRegion(index.row(), itemRelativeRect, name);
}2. 优化 Tooltip 的换行显示逻辑(避免粗暴截断): // 在 helpEvent 中
if (region.rect.contains(itemLocalPos)) {
// 使用 HTML 实现自动换行,避免按字符硬切
QString escapedText = region.fullText.toHtmlEscaped();
QString tooltipHtml = QString("<p style='white-space: pre-wrap;'>%1</p>").arg(escapedText);
QToolTip::showText(event->globalPos(), tooltipHtml, view, region.rect);
return true;
}3. 确保数据更新时缓存被正确清理: |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs, Kakueeen 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 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
search, using original user input directly
content to avoid filtering
delegate for proper state drawing
state to prevent clipping
Log: Improved keyword matching accuracy; fixed list item display under
select state
Influence:
brackets, spaces, etc.)
be cut off
correctly aligned
fix: 移除符号预处理并修复列表代理绘制区域
原始用户输入
绘制正确
Log: 改进的关键词匹配准确性;修复选中状态下列表项显示问题
Influence:
BUG: https://pms.uniontech.com/bug-view-363989.html