Skip to content

feat: optional mouse-wheel value adjustment, off by default (closes #3)#6

Open
Miint-Sunny wants to merge 1 commit into
1756141021:masterfrom
Miint-Sunny:feat/wheel-adjust
Open

feat: optional mouse-wheel value adjustment, off by default (closes #3)#6
Miint-Sunny wants to merge 1 commit into
1756141021:masterfrom
Miint-Sunny:feat/wheel-adjust

Conversation

@Miint-Sunny

Copy link
Copy Markdown
Contributor

概要

给「鼠标滚轮调整数值」加独立开关,默认关闭——解决滚动页面时滚轮误触改动数值框/滑块/下拉的问题。

Closes #3

实现

  • 新增应用级滚轮守卫(wheel_guard.py,单个 QApplication 事件过滤器覆盖现有及未来所有控件,无需改动任何创建点):
    • 开关关闭(默认)时:滚轮滚过 spinbox/slider/combo,数值不变,滚动量直接驱动最近滚动区的滚动条——触控板走 pixelDelta 像素级平滑;不派发合成事件,避免 macOS 触控板 phase/惯性状态被打乱
    • 开关打开时:恢复原生滚轮调值行为
    • 下拉框弹出的选项列表内滚动不受影响
  • 设置面板新增开关「滚轮调整数值」(记忆模式下方),切换即时生效;中英文文案齐备
  • 设置项 wheel_adjust_enabled 存入 AppSettings,随「外观」配置域导入导出
  • 原设置面板中零散的 wheelEvent = ignore 硬屏蔽一并由开关接管(此前即使想用滚轮调值也调不了)

验证

  • 无头行为测试:关闭态三类控件值均不变且列表正常滚动(含 pixelDelta 路径);打开态恢复调值
  • ruff check + pytest(137 例)全绿
  • 基于当前 master 的独立分支,不依赖其他 PR

🤖 Generated with Claude Code

Scrolling a list with the pointer over a spinbox/slider/combo silently
bumped its value (upstream issue 1756141021#3, no undo either). Add an app-wide
wheel guard: when the new settings toggle (off by default, as requested)
is disabled, the wheel is swallowed before the control sees it and the
delta is applied straight to the nearest scroll area's scrollbar — the
list scrolls, the value stays put. Direct scrollbar driving (not synthetic
event forwarding) keeps macOS trackpad pixel deltas smooth and avoids
phase-tracking breakage; combo popup lists still scroll natively. The
per-control wheelEvent=ignore hacks in the settings panel are superseded.
Setting lives in AppSettings (appearance config scope) with zh/en strings
and takes effect live from the toggle.

Closes upstream issue 1756141021#3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

希望添加滚轮调整列表选项的功能关闭开关

1 participant