diff options
author | Marc Mutz <[email protected]> | 2025-06-27 15:15:34 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-07-04 15:31:18 +0200 |
commit | 1228575926383b02479130a68989c4571a5c1ef4 (patch) | |
tree | 941050e5698ef6a943966ffdc34e56cf65a3ad15 /src/gui/kernel/qplatformthemeplugin.cpp | |
parent | c0b19de6eee4883113f95c36bb20c61dadb70a74 (diff) |
QQuaternion: long live Axes / toAxes()
Compilers hate out parameters, so provide a replacement for getAxes(),
toAxes(), that returns the result in a struct Axes { x, y, z } instead.
Then make getAxes() an inline wrapper around a toAxes() call, porting
from Q_ASSERT(x && y && z) to Q_PRE(x); Q_PRE(y); Q_PRE(z); as a
drive-by. The separation gives a more detailed error when triggered,
and produces a shorter assertion string.
Add tests, naturally, and port getAxes() calls that don't test
getAxes() to the new function.
There appear to be no other in-tree users that could be ported.
For symmetry reasons, also add a fromAxes(Axes) overload. Take the
argument by value, to avoid the compiler having to deal with aliasing
analysis. At worst, pass-by-value is like pass-by-cref, and whether
or not the extra copy is added or, since C++17, elided, depends on the
specific call. Suppress Clazy's schizophrenic warning, which complains
that we don't take (QVector3D, QVector3D, QVector3D) by value, but
also if we take struct {QVector x,y,z} by value.
[ChangeLog][QtGui][QQuaternion] Added toAxes(), a getAxes()
replacement.
Task-number: QTBUG-138199
Change-Id: Ie26e16528dc06806e59e54eff2d656a33c322bad
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/gui/kernel/qplatformthemeplugin.cpp')
0 files changed, 0 insertions, 0 deletions