Re: [Interest] Handling stylus input on a tablet in QML/QtQuick

2020-04-20 Thread Thorsten Hofer-Schmitz

Hi

I have seen that bug report, but didn't understand at as "try Qt5.15". 
Just tried it and it seems to work mostly. Hovering also works. But 
there is a bug somewhere. On my Huawei, finger touch causes a hover 
event to start/end (happend in 5.14.2 as well). In the example, if you 
start hover, you can touch the tile once and it becomes red to indicate 
hovering, and a second touch ends it. I can also use my pen for 
hovering, and just like finger touch a press makes the tile permanently 
red. But with my pen I can't end hovering, I have to touch it with my 
finger for that.


I don't understand the problems with pen input in QtQuick. QTabletEvent 
works just fine, in QWidget and QtQuick. The engine just converts the 
event. Why not just use that, unlike HandlerPoint it supports tilt and 
tangetial pressure as well. It's just missing hovering, which Qt for 
some reason tied to QApplication/QWidget. And that code should be 
movable to QGuiApplication, the events come from the host after all, Qt 
is just processing them. That doesn't make sense to me (as someone who 
doesn't know much about the interals of this).


Am 20.04.2020 um 06:07 schrieb Shawn Rutledge:



On 19 Apr 2020, at 01:16, Thorsten Hofer-Schmitz 
 wrote:

Hi

I'm trying to handle the input of a stylus on a tablet. Qt has an example on 
how to do this using a QWidget-based application. I tested it on my tablet and 
everything works fine.

I would like to do this in QML/QtQuick. The documentation suggests that 
PointHandler, like this:

import QtQuick 2.14
import QtQuick.Window 2.14

Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")

PointHandler
{
acceptedDevices: PointerDevice.Stylus
acceptedPointerTypes: PointerDevice.Pen
onActiveChanged: console.log("Pen Input")
}

}

It should work in 5.15: see also QTBUG-79660 and the tablet manual test in 
qtdeclarative/tests/manual/pointer.


I experimented with eventFilter's to intercept QTabletEvent's before they are 
converted into mouse events by the QQuickWindow (as far as I can tell). But 
unless there is a QWidget with WA_TabletTracking=true as target (and some other 
options as it seems, because just a QMainWindow with a widget isn't enough) I 
can't recieve TabletEnterProximity-events for hovering.

Those are currently not delivered to the main window, only to the application.  
So you still need a C++ subclass in Qt 5, as in 
qtbase/examples/widgets/widgets/tablet/tabletapplication.cpp.  I’m hoping to 
get more complete proximity event delivery in place in Qt 6.



___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] Handling stylus input on a tablet in QML/QtQuick

2020-04-18 Thread Thorsten Hofer-Schmitz

Hi

I'm trying to handle the input of a stylus on a tablet. Qt has an 
example on how to do this using a QWidget-based application. I tested it 
on my tablet and everything works fine.


I would like to do this in QML/QtQuick. The documentation suggests that 
PointHandler, like this:


import QtQuick 2.14
import QtQuick.Window 2.14

Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")

PointHandler
{
acceptedDevices: PointerDevice.Stylus
acceptedPointerTypes: PointerDevice.Pen
onActiveChanged: console.log("Pen Input")
}

}

But it doesn't work, and I can't find out how to make it work.

I experimented with eventFilter's to intercept QTabletEvent's before 
they are converted into mouse events by the QQuickWindow (as far as I 
can tell). But unless there is a QWidget with WA_TabletTracking=true as 
target (and some other options as it seems, because just a QMainWindow 
with a widget isn't enough) I can't recieve TabletEnterProximity-events 
for hovering.


Does someone know how to do this?

Regards

Thorsten
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest