Skip to content
  • David Edmundson's avatar
    Avoid QPointer in return types of Input methods · 6acf35e4
    David Edmundson authored and Vlad Zahorodnii's avatar Vlad Zahorodnii committed
    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.
    6acf35e4