[Suggestion] Using the Eraser of a stylus

(Morgan Reed) #1

Is it possible in future releases of Pencil to use the eraser end of a stylus using QTabletEvent::Eraser ?

Source: https://doc.qt.io/qt-5/qtabletevent.html#PointerType-enum

(Jose Moreno) #2

@velocireed I’ll wait for the others to comment on the programming side, but as far as I have experienced with a Wacom Intuos Pro 5 tablet, Pencil2D already had the eraser mapped to the stylus eraser, and such issue was present years ago, but it was fixed here: https://github.com/pencil2d/pencil/issues/326

Edit: This is the specific pull request https://github.com/pencil2d/pencil/pull/325

(Morgan Reed) #3

I appreciate the response; the reason I ask is because I animate on my Surface Go, and for some reason the eraser is the same tool as what was selected. Maybe the QTabletEvent::Eraser only applies to drawing tablets? That doesn’t seem to make too much sense, but I will continue looking in to it. It’s probably an issue with the Surface, so I’ll see if I can find a workaround.

(scribblemaniac) #4

Yes we already handle stylus erasers in this part of the code. If it is not switching to the eraser than it is a bug. It could be something with Pencil2D, but more likely is a problem with Qt. Looking at the Surface Go, it’s possible that it is triggering QTouchEvents rather than QTabletEvents. Does your eraser work with any other applications such as Krita? If you want to dig into the code I would start by throwing some debug messages or breakpoints around that area I linked and seeing what is and isn’t getting called.

(Morgan Reed) #5

I have just tested it with Krita and it does look like the same issue is present. How would I get debug messages from Pencil? Do I just run it from QT and look for any errors? I’m a bit of a novice when it comes to programming (especially with QT), so I appreciate the help

(scribblemaniac) #6

Yes if you run it from QT Creator, you can see all of the debug messages in the application log panel which usually pops up. You can add your own messages like this:

qDebug() << "Hello world" << thisIsAVariable << "and here is some more text";

So for this, I would start by adding this line before the if statement:

qDebug() << "ScribbleArea::tabletEvent" << event.pointerType();

and then looking for messages when I use the regular stylus and the eraser that start with ScribbleArea::tabletEvent. If there are such messages, a number will be at the end of the message from event.pointerType(), which I can look up here to see if the eraser is returning the correct pointerType. If there are no messages like that, then it’s not being interpreted as a tablet.