Hi, I tested simple code for detecting touch event on touch-screen, but QEvent.TouchBegin, QEvent.TouchUpdate, QEvent.TouchEnd are not detected at all. Anyone help? Thank you.
import sys import math from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.uic import * from types import * def handleEvent(self, event): if event.type() in [QEvent.TouchBegin, QEvent.TouchUpdate, QEvent.TouchEnd]: print ("Touch event") print (event.type()) tp = event.toichPoints() for p in tp: print(p.pos()) return True app = QApplication(sys.argv) w = loadUi("main.ui") w.widget.setAttribute(Qt.WA_AcceptTouchEvents) w.widget.event = MethodType(handleEvent, w.widget) w.show() sys.exit(app.exec_()) [color=#000000][font=DejaVu Sans Mono]