Qt MouseDoubleClickEvent May Slow Down Performance

http://qt-project.org/doc/qt-4.8/qwidget.html#mouseDoubleClickEvent

I just discovered this. I’ve been implementing the convenience overriding of MouseDoubleClickEvent in all of my custom widgets. After optimizing all of my basic overrided mouse handling events: mousePressed, mouseMove, mouseReleased, it turns out it was that dang doubleclick that slowed it all down in the end. And all this time I thought I hadn’t written a tight optimized rendering loop.

Anyway, BE VERY CAREFUL with this. As it states in the reference documentation:

Note: The widget will also receive mouse press and mouse release events in addition to the double click event. It is up to the developer to ensure that the application interprets these events correctly.

That means that if you already have all your mousePress and mouseRelease custom overriding functions implemented, those will get called multiple times before it gets to the new override implementation of doubleclick, which will slow everything down exponentially. That doesn’t mean it’s a bug, that’s technically how a double-click is implemented at the internal level.

It looks like the only way to get optimal performance is to implement double-click yourself with a timer or variable.

Well, damn.

CategoriesQt