[Qt-interest] QCursor::setPos very slow on OSX
David Forstenlechner
dforsten at newtek.com
Tue Sep 8 10:26:39 CEST 2009
The function "QCursor::setPos" is horribly slow on OSX,
blocks the application for about 400ms on each call,
which makes it unusable when a smooth user experience is required.
Reading the Qt source code documentation for that function in
"qcursor_mac.mm" reveals that the programmer who wrote the OSX version
knew that the implementation was troublesome:
>> /*
>> I'm not too keen on doing this, but this makes it a lot easier, so
>> I just send the event back through the event system and let it get
>> propagated correctly
>> ideally this would not really need to be faked.
>> */
A peek at the origin/4.6-stable branch reveals that this problem still
is not fixed.
For now, does someone know a workaround to avoid calling "setPos" but
still get relative mouse move information when the mouse would go beyond
the border of the screen?
Rationale:
This is needed for a "DragButton" where the cursor is hidden, and the
user can change a value by dragging with the mouse. This dragging should
obviously not be stopped when the invisible cursor hits the edge of the
screen, at which point the "setPos" function is called to reset it,
as well as at the end of the drag to position the mouse cursor at the
original point.
Cheers,
DavidF
PS.: I hope Nokia has hired some Cocoa programmers to clean the OSX
implementation of Qt up, currently it makes a pretty experimental
impression in many areas (CSS styling is pretty borked as well for
example, as well as transparent Widget backgrounds in QGraphicsScene).
More information about the Qt-interest-old
mailing list