-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add horizontal scrolling to MainWindow QMdiArea #5174
base: master
Are you sure you want to change the base?
Conversation
I've made the Only issue right now that I can't see why it's happening is in the Song Editor when horizontal scrolling is at the limits it will scroll up/down even with Shift held. I'm not sure if this is a bug with Qt or LMMS's handling of the event. |
Vertical scroll worked before you added this, no? I assume something like this is happening:
I could be wrong, but I don't think you need a new class + scroll handler to allow horizontal scroll. You should be able to override the scroll handling in the relevant class, I think? Maybe you could check for shift, delegate to the super handler if it doesn't exist, and then only handle the shift case... |
Essentially, I'd guesd that wheelEvent bubbles up to SomeClass, and then bubbles from SomeClass to MainWindow. SomeClass probably ignores the event when vertical scroll isn't possible. |
I actually didn't test if this was before behavior, but it's improper IMO either way.
I tried this first, you can see in my opening comment about my tests with it. |
I believe I've found the cause. // always pass wheel-event to parent-widget (song-editor
// bb-editor etc.) because they might want to use it for zooming
// or scrolling left/right if a modifier-key is pressed, otherwise
// they do not accept it and we pass it up to QScrollArea
m_trackContainerView->wheelEvent( _we ); Once it's ignored in I believe if I add the horizontal scroll to this area it should fix the issue, and I'll have to make sure it doesn't mess anything else up. 😩 |
So after some debugging, I've found that void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
{
Q_D(QAbstractScrollArea);
if (e->orientation() == Qt::Horizontal)
QApplication::sendEvent(d->hbar, e);
else
QApplication::sendEvent(d->vbar, e);
} Getting the |
…from AutomationEditor if at scroll limits
8731378
to
ca59482
Compare
🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩
Windows
Linux
macOS🤖{"platform_name_to_artifacts": {"Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://12165-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.67%2Bg709d40221-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12165?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://12164-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.67%2Bg709d40221-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12164?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/i81mvwga0o3ck4oh/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/37303169"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/gbgin9yvbyb5g31p/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/37303169"}], "Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://12161-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.67%2Bg709d402-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12161?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://12162-15778896-gh.circle-artifacts.com/0/lmms-1.3.0-alpha.1.67%2Bg709d40221-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/12162?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "ca59482b299691eef7ff3922a9de952fc65f55a2"} |
WIP Fix for #5169.
My first attempt was to capture
MainWindow
'swheelEvent
but there were times when that wouldn't capture the event properly. I took the step to subclass QMdiArea just to capturewheelEvent
s for this purpose.Currently scrolling works unless you are hovering over the Song Editor or Piano Roll. I'm looking into how to handle those cases.
Vertical and horizontal scrolling will double speed when using the Control key. I haven't looked into how much more this should be, but it's a modifier to the scroll wheel angle delta. Subtraction is used because of positive/negative angle delta values for scrolling backwards/forwards.
By Qt's documentation, most mouse steps are 15 degrees (what I get when I scroll is +/-15), but some may be smaller. In those cases this will scroll slower, so we could use a constant number or figure out another approach to use.
I'm not certain if this will work on track pad's scrolling, I don't have one to test with.