Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, August 2006
[Qt3] Compression of mouse motion events (bug?)


Message 1 in thread

I have an opengl application where I use the mouse to draw a freehand
curve. If the application is slow to render I only get very coarse mouse
motion events, which means the freehand curve doesn't follow the mouse
as precisely as it could. I can see in qapplication_x11.cpp:4016-4036
(qt-x11-free-3.3.6) that Qt compress mouse move events and toss out the
lot except the very last one, so I have Qt to thank for this problem :-)


I don't understand why such compression is hardcoded in Qt - why not 
instead do one of the following

1) translate all MotionNotify events into QEvent::MouseMove events. Note 
in a flag whether the mouse event could have been compressed/ignored, 
ie: QMouseEvent::ignorable();

2) Alternatively, keep compressing several MotionNotify events into a 
single QMouseEvent, but record intermediate positions and make them 
available e.g. like this: std::vector<QPoint> 
QMouseEvent::compressedPositions()/compressedGlobalPositions();


Best regards,

Thomas

--
 [ signature omitted ] 

Message 2 in thread

Hi,

> I don't understand why such compression is hardcoded in Qt - why not 
> instead do one of the following

Because the following is probably of no interest to the majority of Qt 
users. Is the compression really hard-coded in a way that cannot be 
overridden? I haven't really looked at it, but I suspect one of these 
approaches may give access to uncompressed events:
	http://doc.trolltech.com/3.3/qapplication.html#notify

--
 [ signature omitted ] 

Message 3 in thread

Dimitri wrote:
> Hi,
> 
>> I don't understand why such compression is hardcoded in Qt - why not 
>> instead do one of the following
> 
> Because the following is probably of no interest to the majority of Qt 
> users. Is the compression really hard-coded in a way that cannot be 
> overridden? I haven't really looked at it, but I suspect one of these 
> approaches may give access to uncompressed events:
>     http://doc.trolltech.com/3.3/qapplication.html#notify
> 
> -- 
> Dimitri


They are accessible, but not in a platform independent way. I override 
both x11Event and mouseMoveEvent. In x11Event I record all the 
MotionNotify events and in mouseMoveEvent I process them. Hopefully my 
app will never need to run on Windows ;-)

--
 [ signature omitted ]