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
Use tablet events for tablet input #1059
Conversation
Thanks @scribblemaniac will test it as long as I have the tablet with me. |
Agh... the problem is so obvious. We don't do anything with tablet events... all our tools expect QMouseEvents which are called from scribblearea::mouse<press,release,move>event(). The corresponding tabletmoveevent does not do anything so of course tablet support is broken now that we're trying to use those events. The solution is rather simple: |
@candyface Thanks for testing. I don't know how I missed that. I guess I saw the stroke manager call in scribblearea and assumed all of them were being done from there, not just the first and last points. |
As discussed in Discord, I have now implemented the tablet overrides in the drawing tools. I also couldn't resist doing a bit of refactoring. I have tested the implementation using my Artisul D13 tablet. |
Still need to implement for hand, move and select. Will do that tomorrow edit: still actively looking into this... I've hit a rather peculiar problem though that affects select and move tool tablet... which means they break. For some reason the transformation is not the same... which is odd considering that the mouse and tablet both seem to have identical coordinates ( ̄_ ̄ ) |
fc8ef5a
to
515dcf2
Compare
Alright this should be good to go now. I could still refactor a lot to get that dreadful copy paste away though but functionality wise, all tools should work now with proper tablet input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@candyface So now most things appear to be working for the mouse. However when I am using a drawing tool and then I move the canvas with the middle mouse button, the program remains stuck in that mode and I cannot draw until I switch tools.
Agh... will fix when I get home. I haven't been able to test that because I don't have a middle mouse button but I'll figure something out. |
Okay, I figured it would be easier for me to fix it then. Ended up being a very simple fix. This should be good to go now as far as I can tell. 👍 |
Looking at this PR again, I have a question.
Seems they are doing exactly what mouseEvent functions are doing, Is it correct? Or are there any differences for a specific tool? |
@chchwy You are correct, the tabletevent and mouseevent functionality is very similar (and identical in some cases) to each other (especially after i've moved all the button related code out) and could be merged. We could consider getting rid of QTabletEvent and QMouseEvent and make it possible to get them as value from Basetool or... create a new custom struct that holds the values we require from each EventType. |
Pencil, pen, brush tools are always active in vector layers if using a tablet. But working ok with a mouse. |
From the Qt docs:
So I refactored the code to handle the tablet event instead of ignoring it and Qt possibly compressing it as mouse events.
Please test thoroughly as I don't have a tablet to test this on myself. Particularly on a Wacom as I did remove the "patch". As far as I can tell for tablet events,
event->posF()
should equalevent->pos() + mTabletPosition - mTabletPosition.toPoint()
.