leozide / leocad

A CAD application for creating virtual LEGO models
https://www.leocad.org
2.48k stars 211 forks source link

Support macOS mouse gestures #809

Open superruzafa opened 2 years ago

superruzafa commented 2 years ago

Is your feature request related to a problem? Please describe. LeoCAD works great with keyboards and standard mouse devices, but it could be take advantage of the mouse gestures provided by the MacOS trackpad devices.

Describe the solution you'd like When using LeoCAD with a trackpad like the ones from the MacBooks I intuitively expect that:

Describe alternatives you've considered None so far.

Additional context I did a quick experiment to handle those already delivered macOS events. This is the result:

Grabación de pantalla 2022-04-30 a las 15 03 42

I know the behaviour is buggy but I wonder if this can be helpful for implement this feature.

leozide commented 2 years ago

This is a good idea, but there are a couple of issues with your implementation so I rewrote your pan gesture code. I'll look at zoom and rotate when I can.

Why did you use QNativeGesture instead of QGesture?

superruzafa commented 2 years ago

Sure, the idea was to demonstrate the potential of the MacOS gestures and that they could be easily implemented.

This has been my first time dealing with C++ and QT. I did my best finding examples and reading the QT documentation. For sure there is a much better way to implement this, so feel free to take the ideas you want or rewrite completely this PR when you want 😉