diff options
author | Marc Mutz <[email protected]> | 2025-06-24 16:27:18 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-07-04 15:31:18 +0200 |
commit | 31b846ffbf12cdbd70ffecf61c63c6215a48f605 (patch) | |
tree | 143d25166cd505dc375699288e1063f580ac70e9 /src/gui/opengl | |
parent | 1228575926383b02479130a68989c4571a5c1ef4 (diff) |
QPainter is highly optimized, to the point that the getters are
returning by cref and not by value.
So overload the setter for the common case of users passing
temporaries in order to save the atomic ref/deref.
This does not alleviate the need for the existing (QColor),
(Qt::PenStyle), etc overloads, because those avoid even the allocation
of a QPen/BrushPrivate in certain cases, and they don't need to
checkEmulation() (whatever that is). That's why we don't reimplement
them to call the new rvalue overloads, even though that would DRY the
code somewhat.
There are other setters which one might consider giving rvalue
overloads. Here's why I didn't:
- The various QTransform getters return by cref, too, but move = copy
for QTransform, so a setter rvalue overload wouldn't change
anything.
- The QFont getter also returns by cref, but the setter is resolving
fonts internally, and those operations are not optimized for
rvalues, so it would be premature to add this. Filed QTBUG-138025 to
keep track.
[ChangeLog][QtGui][QPainter] Added overloads of setPen() and
setBrush() that take rvalues.
Change-Id: Ie3cf16e7fa64c81d217eb396a6fdde4c7d6f066b
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/gui/opengl')
0 files changed, 0 insertions, 0 deletions