Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Detect pen pressure of touch screen
rock wang last edited by
I'm develping a palette app using canvas.
When drawing line on a touch screen(MS Surface notebook), I want to adjust lineWidth according the pen pressure(thicker or thinner).
How to achieve this?
that sounds like a very platform specific issue, doubtfull that theres a Qt-api for that, I may be wrong though.
I would look to Microsoft and c++ accessable pen pressure
for example this Microsoft forum thread:
wrosecrans last edited by
I don't have a Surface to test with, but in theory, it should use the same API's as stuff like Wacom tablets: http://doc.qt.io/qt-5/qtwidgets-widgets-tablet-example.html
QTabletEvent has a pressure() method that you can use to control line thickness of whatever is appropriate for your app. If the tablet example at that link doesn't respond to the Surface pen, then I don't know if there will be an easy way to use it with Qt API's. You might have to look into directly getting native events and mucking around with Windows specific event handling code, which is a bit gross.