2

I can't find any reference to this error anywhere at all...

I've got a widget with a QWebView up and I'm trying to interact with it with a Touchscreen. Every time I touch the screen, I get the message:

Got touch without getting TouchBegin for id ####

Where #### is a (seemingly arbitrary) four-digit number. Here's my code:

import sys
from PyQt4 import QtGui, QtCore, QtWebKit
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *

if __name__ == '__main__':
    app = QApplication(sys.argv)
    browser_window = QWebView()
    browser_window.load(QUrl("http://www.wikipedia.org"))
    browser_window.setAttribute(Qt.WA_AcceptTouchEvents)
    browser_window.show()

    app.exec_()

Has anyone seen this error before? Or anything similar?

I tried installing an event filter, so see what the QWebView is actually receiving, and despite the WA_AcceptTouchEvents flag the only events that the QWebView is receiving are mouse events.

zaxvo
  • 186
  • 1
  • 10

1 Answers1

0

I think the issue is specifically with Ubuntu's patch of Qt 4.8.I found a similar issue here:

https://gabrbedd.wordpress.com/2012/07/10/getting-multitouch-qt-on-ubuntu-12-04/

I think switching to Qt5 will fix it, and I confirmed that with PyQt. This works (after installing some python3-pyqt5 stuff):

#!/usr/bin/python3

import sys
from PyQt5 import QtGui, QtCore, QtWebKit
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtWebKit import *
from PyQt5.QtWebKitWidgets import *

if __name__ == '__main__':
    app = QApplication(sys.argv)
    browser_window = QWebView()
    browser_window.load(QUrl("http://www.wikipedia.org"))
    browser_window.setAttribute(Qt.WA_AcceptTouchEvents)
    browser_window.show()

    app.exec_()
Jeffeb3
  • 111
  • 1
  • 6