QWidget touch event
Hi, I am developing GUI app using QtDesigner and PyQt4. I have touch display, and want to implement pinch-zoom method. But i have problem with touch events. I am running simple code with event handler , I am entering the function (I tested it with print statement right before if statement) but QEvents are not detected. Please any suggestions, what am I doing wrong?
P.S Mouse events are working, I have problem with touch events.
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")
tp = event.toichPoints()
for p in tp:
app = QApplication(sys.argv)
w = loadUi("main.ui")
w.widget.event = MethodType(handleEvent, w.widget)
What does " i have problem with touch events" mean in your case?
ps: And please use code tags when posting code
import foo from bar def foobar(): print("this is more readable")
is much easier to read than
import foo from bar
print("this is not readable")