On Thu, 14 Apr 2011 15:50:34 +0400, Anton Chikin <[email protected]> wrote: > On Thu, Apr 14, 2011 at 3:11 PM, Phil Thompson > <[email protected]> wrote: >> On Thu, 14 Apr 2011 13:57:09 +0400, Anton Chikin >> <[email protected]> >> wrote: >>> On Wed, Apr 13, 2011 at 9:09 PM, Phil Thompson >>> <[email protected]> wrote: >>>> On Wed, 13 Apr 2011 14:31:05 +0400, Anton Chikin >>>> <[email protected]> >>>> wrote: >>>>> Hello All, >>>>> >>>>> I'm using PyQt version 4.8.3-2, shipped with Ubuntu 11.04 beta. While >>>>> I was trying to use new multitouch testing function >>>>> QTest::touchEvent() http://doc.qt.nokia.com/4.7/qtest.html#touchEvent >>>>> I've come across the issue. This piece of code >>>>> >>>>> from PyQt4 import QtTest >>>>> def testMT(self): >>>>> QtTest.QTest.touchEvent(self).press(0, QPoint(100,100)) >>>>> >>>>> causes >>>>> >>>>> AttributeError: type object 'QTest' has no attribute 'touchEvent' >>>>> >>>>> I discovered that this function is not listed in PyQt4 docs. >>>>> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtest.html >>>>> >>>>> Could you please give me some guidelines to resolve this? >>>>> Thank you! >>>>> Anton Chikin. >>>> >>>> Hmm - not sure how it got missed. It will be in tonight's snapshot. >>>> >>>> Thanks, >>>> Phil >>>> >>> >>> Hi Phil, >>> >>> I've come across another issue using multitouch test functions. >>> Please have a look at QTouchEventSequence doc page >>> http://doc.qt.nokia.com/4.7-snapshot/qtest-qtoucheventsequence.html >>> I wrote the following sample to demonstrate the issue: >>> >> ------------------------------------------------------------------------------------- >>> import sys >>> import inspect >>> from PyQt4 import QtCore, QtGui, QtTest >>> >>> class MyLabel(QtGui.QLabel): >>> def __init__(self, string, parent = None): >>> QtGui.QLabel.__init__(self, string, parent) >>> self.resize(500,300) >>> >>> def event(self, evt): >>> if evt.type() == QtCore.QEvent.TouchBegin: >>> print("TouchBegin!") >>> #Double click causes QTouchEvent to be sent >>> if evt.type() == QtCore.QEvent.MouseButtonDblClick: >>> print("Double click!") >>> self.testMT() >>> return QtGui.QLabel.event(self, evt) >>> >>> def testMT(self): >>> evSeq = QtTest.QTest.touchEvent(self) >>> print(inspect.getmembers(evSeq)) >>> evSeq.press(0, QtCore.QPoint(10,10), self) #<------- Python >>> crashes here! >>> print("MT event sent!") >>> return >>> >>> if __name__ == "__main__": >>> app = QtGui.QApplication(sys.argv) >>> label = MyLabel("Hello!") >>> label.show() >>> app.exec_() >>> sys.exit() >>> >> -------------------------------------------------------------------------------------- >>> At the line, where I try to call QTouchEventSequence.press() - Python >>> crashes with core dump. >>> Is this the real issue or just I am doing wrong things? >> >> It looks like QTouchEventSequence has a really dumb API which means it's >> unusable in anything other that C++ code. You have to use the instance >> immediately - you can't make a copy on the heap to pass around and use >> later. >> >> Unless anybody has any suggestions I'll remove it completely. >> >> Phil >> > > Phil, > > Unfortunately, QTouchEventSequence is crucial for multitouch testing, > because QTouchEvent constructor is private, and I can't just > instantiate and pass to the event system. > Maybe we'll wrap that tricky API into more Python-convenient functions > on C++ side? What do you think?
Good luck - from my quick look I don't think it's possible, but I'm happy to be proved wrong. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
