Touchscreen not working (Ntrig/Wacom)
-
Hello,
Problem in short form:
I have a Sony Vaio Duo with an Ntrig Digitizer with touchscreen and Stylus. However, my Qt5 application is not receiving touch events,Platform is Linux/X11, with Xinput2.2, using PyQt5, and the Ntrig is running with the Wacom Tablet driver (XInput Multitouch driver does not really support stylus).
My application does get tablet events, but these are of no use with the QScroller...
Long form:
My main point is that everything works fine in GTK3 . For example in Evince, I can select with mouse/touchpad/stylus, but scroll with my fingers. This is exactly the behavior that i'd like to have.My Python Code:
@
from PyQt5.QtWebKitWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *import sys
app = QApplication(sys.argv)
class Filter(QObject):
def eventFilter(self, target, event):
if event.type() == QEvent.ScrollPrepare:
p = view.page()
f = p.frameAt(event.startPos().toPoint())
self.f = f
pos = QPointF(f.scrollBarValue(1), f.scrollBarValue(0))
rang = QRectF(QPointF(0,0), QPointF(f.scrollBarMaximum(1), f.scrollBarMaximum(0)))
event.setContentPos(pos)
event.setContentPosRange(rang)
event.setViewportSize(QSizeF(p.viewportSize()))
event.setAccepted(True)
self.ev = event
return True
if event.type() == QEvent.Scroll:
self.ev = event
self.f.setScrollBarValue(0, event.contentPos().y())
self.f.setScrollBarValue(1, event.contentPos().x())print event return False
view = QWebView()
f = Filter()
view.setAttribute(Qt.WA_AcceptTouchEvents)
view.installEventFilter(f)
QScroller.grabGesture(view), QScroller.LeftMouseButtonGesture)
view.load(QUrl("http://google.com"))
view.show()sys.exit(app.exec_())
@This works so far, but I'd like to set the QScroller to take only touch events, or make it react to TabletEvents.
(As a note by, QScroller with WebVew seems broken, the qtwebkit-examples/examples/webkitwidgets/scroller/plot/ example does not not work and there does not seem to be any code in QtWebView for handling of a QScroller, thats why I handle these events in the Filter class.)
thanks in advance,
Marcel