[PyQt] distinguish / enable / disable multiple pointer devices
David Boddie
david at boddie.org.uk
Fri Mar 25 00:11:46 GMT 2011
On Friday 25 March 2011 00:10:21 +0100, Gelonida wrote:
> I have a PC (Windows) with a mouse, a touch screen and a graphics tablet.
>
> Is there any way to know with which device a widget was clicked?
If the widget interprets a mouse click, screen touch or a press on the
tablet as mouse events then there may not be a way to distinguish between
them. In other words, if Windows converts events to mouse clicks and sends
them to Qt then there wouldn't be a way to tell.
> Is there any way to disable for example the touch screen events for one
> widget and the mouse events for another?
If you are receiving different kinds of events for the mouse, screen and
tablet then you could install event filters to stop certain kinds of events
from being delivered to each widget. Qt has classes to represent these
kinds of events:
QMouseEvent: http://doc.qt.nokia.com/4.7/qmouseevent.html
QTabletEvent: http://doc.qt.nokia.com/4.7/qtabletevent.html
QTouchEvent: http://doc.qt.nokia.com/4.7/qtouchevent.html
So, in theory, it should be possible.
David
More information about the PyQt
mailing list