Skip to content

fix: QComboBox ignore wheel event when not reacting to it - #66

Merged
Zeno-sole merged 1 commit into
deepin-community:masterfrom
wjyrich:fix-ComboBox-WheelEvent
Sep 16, 2026
Merged

Zeno-sole merged 1 commit into
deepin-community:masterfrom
wjyrich:fix-ComboBox-WheelEvent

Conversation

@wjyrich

@wjyrich wjyrich commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Cherry picked from qtbase upstream dev branch commit 9c966d837fe33b1e32f5e95f29a380dd3063055b ("QComboBox: Ignore wheel event when not reacting to it").

When SH_ComboBox_AllowWheelScrolling is false, combo boxes did not react to wheel scrolling but also did not ignore the event, so it was eaten instead of propagating up. Parent scroll areas therefore never scrolled.

Log: 从上游 cherry-pick 修复 QComboBox 未响应滚轮时未向外传递滚轮事件的问题

Influence: 当 QStyle::SH_ComboBox_AllowWheelScrolling 为 false 时,滚轮事件会向上冒泡,外层 QScrollArea 等控件可正常滚动。

PMS: BUG-339039

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Hi @wjyrich. Thanks for your PR. 😃

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Hi @wjyrich. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@wjyrich
wjyrich force-pushed the fix-ComboBox-WheelEvent branch from ae9a31d to b8c1908 Compare September 16, 2026 05:45
@github-actions

Copy link
Copy Markdown

TAG Bot

TAG: 6.8.0+dfsg-0deepin34
EXISTED: no
DISTRIBUTION: unstable

Cherry picked from qtbase upstream dev branch commit 9c966d837fe33b1e32f5e95f29a380dd3063055b
("QComboBox: Ignore wheel event when not reacting to it").

When SH_ComboBox_AllowWheelScrolling is false, combo boxes did not react to
wheel scrolling but also did not ignore the event, so it was eaten instead of
propagating up. Parent scroll areas therefore never scrolled.

Log: 从上游 cherry-pick 修复 QComboBox 未响应滚轮时未向外传递滚轮事件的问题

Influence: 当 QStyle::SH_ComboBox_AllowWheelScrolling 为 false 时,滚轮事件会向上冒泡,外层 QScrollArea 等控件可正常滚动。

PMS: BUG-339039
@wjyrich
wjyrich force-pushed the fix-ComboBox-WheelEvent branch from b8c1908 to 3d8e67f Compare September 16, 2026 05:51
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind
Once this PR has been reviewed and has the lgtm label, please assign goldendeng for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Zeno-sole

Copy link
Copy Markdown
Contributor

/test ai-review

@Zeno-sole

Copy link
Copy Markdown
Contributor

/test all

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 99 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 99 分,大于 70 分通过阈值。本次提交从 Qt 上游 cherry-pick 修复 QComboBox 滚轮事件传播问题,代码改动最小化且附带完整测试用例,无安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 语法正确,逻辑清晰。else { e->ignore(); } 分支正确处理了 QComboBox 不响应滚轮事件时的事件传播,符合 Qt 事件传播机制。测试代码使用数据驱动测试(QFETCH/QCOMPARE)结构规范。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. debian/patches/fix-ComboBox-Wheelevent.patch:0 - 补丁文件名 "Wheelevent" 大小写不一致,Qt 中标准命名为 "WheelEvent"(驼峰命名),建议重命名为 fix-ComboBox-WheelEvent.patch 以保持一致性

建议: 代码结构清晰,注释完整。上游 commit message 详细解释了修复原因和背景。测试代码覆盖全面,包含自定义 QProxyStyle 和事件接收检测。建议修正补丁文件名中的大小写不一致问题。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 性能良好,资源使用合理。修改仅添加 e->ignore() 调用(O(1) 操作),无额外计算开销或资源消耗。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 存在0个安全漏洞。本次修改仅涉及 GUI 事件传播逻辑,无用户输入处理、网络通信、文件 I/O 或命令执行,不存在安全风险。


💡 改进建议代码示例

// 修正补丁文件名
// 原文件名: debian/patches/fix-ComboBox-Wheelevent.patch
// 建议改为: debian/patches/fix-ComboBox-WheelEvent.patch
//
// 同时需要更新 debian/patches/series 中的引用(如存在)
//
// 核心代码修复无需改动,当前实现已正确:
// qcombobox.cpp - wheelEvent 函数
void QComboBox::wheelEvent(QWheelEvent *e)
{
    // ...
    if (style()->styleHint(QStyle::SH_ComboBox_AllowWheelScrolling)) {
        // 处理滚轮滚动
        d->emitActivated(d->currentIndex);
        e->accept();
    } else {
        e->ignore();  // 新增:忽略事件,使其向上传播
    }
}

本报告由 AI 代码审查工具自动生成

@Zeno-sole
Zeno-sole merged commit 3b697f1 into deepin-community:master Sep 16, 2026
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants