feat: Implement full-row hover effect in DataTreeView#398
feat: Implement full-row hover effect in DataTreeView#398dengzhongyuan365-dev wants to merge 2 commits intolinuxdeepin:masterfrom
Conversation
There was a problem hiding this comment.
Sorry @dengzhongyuan365-dev, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev 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 |
- Added a new ItemViewRowHoverProxyStyle to manage hover effects for rows in the DataTreeView. - Enhanced the drawRow method to support full-row highlighting on hover, improving user interaction. - Introduced mouse tracking and hover row management to update the visual state based on mouse position. - Updated mouseMoveEvent and leaveEvent to handle hover state changes effectively. This feature enhances the visual feedback for users, making the interface more intuitive and responsive. bug: https://pms.uniontech.com/bug-view-283255.html
- Modified the progress update logic to accept sub-percent values while ensuring monotonic progress. - Introduced a throttling mechanism to limit UI updates, reducing potential performance issues from frequent progress changes. - Enhanced reset and timer restart functions to invalidate the UI update timer appropriately. These changes enhance the responsiveness and accuracy of the progress display, improving user experience during long-running tasks. bug: TASK: https://pms.uniontech.com/task-view-388835.html
b600213 to
2e5efe8
Compare
deepin pr auto review这段代码主要包含三个方面的修改: 1. 语法逻辑ProgressPage::setProgress
DataTreeView 绘制与事件
ItemViewRowHoverProxyStyle
2. 代码质量
3. 代码性能
4. 代码安全
总结与改进建议
修改后的 // ...
const int iPercent = qMin(100, qRound(dPercent));
const bool percentChanged = (iPercent != m_iPercent); // 修正变量名
if (percentChanged) {
m_iPercent = iPercent;
m_pProgressBar->setValue(m_iPercent);
m_pProgressBar->update();
}
if (!m_uiUpdateTimer.isValid()) {
m_uiUpdateTimer.start();
}
// 逻辑:如果整数进度没变,且时间未到,则直接返回
if (!percentChanged && m_uiUpdateTimer.elapsed() < 200) {
return;
}
// 只要走到了这里,说明需要更新 UI(要么进度变了,要么时间到了)
// 重置计时器,以便下次计算间隔
m_uiUpdateTimer.restart();
// 后续更新速度和剩余时间的逻辑...这样逻辑更清晰:只有决定要执行更新操作时,才重置计时器。原来的代码在 |
This feature enhances the visual feedback for users, making the interface more intuitive and responsive.
bug: https://pms.uniontech.com/bug-view-283255.html