emulate mouse move in default implementation of QPlatformCursor::setPos

When QCursor::setPos() is called and the platform plugin doesn't
implement QPlatformCursor::setPos, a warning is printed.
Additionally, we now emulate a mouse move to have a default
implementation that's actually useful.

QPlatformCursor::pos() now returns the position that was set by
QPlatformCursor::setPos(), or other facilities that generate mouse events,
for example the Tslib plugin.

Change-Id: Ifc539202765f311baad085f72347aeb732f7b2ba
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Joerg Bornemann 2014-09-16 15:42:30 +02:00
parent 06c31bdbec
commit 541b387c10

View File

@ -122,8 +122,13 @@ QPoint QPlatformCursor::pos() const
void QPlatformCursor::setPos(const QPoint &pos)
{
Q_UNUSED(pos);
qWarning("This plugin does not support QCursor::setPos()");
static bool firstCall = true;
if (firstCall) {
firstCall = false;
qWarning("This plugin does not support QCursor::setPos()"
"; emulating movement within the application.");
}
QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton);
}
// End of display and pointer event handling code