Skip to content

Avoid QPointer in return types of Input methods

David Edmundson requested to merge work/faster_input into master

QPointer is a really useful way to store a pointer over time. It doesn't make have any value as a return value used by a short-lived method.

There isn't a good copy constructor, it's effectively the same as creating a new QWeakPointer reference that has to be cleaned up.

Testing if something is null is still the same. A new QPointer can be made by the caller if it actually is needed.

Input handling is a very hot path called many times a frame, so it's important to keep this light. focus() and at() are called a lot which added up to slightly over 1% of CPU time when moving the mouse about.

Merge request reports

Loading