diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/compat/removed_api.cpp | 13 | ||||
-rw-r--r-- | src/gui/kernel/qguivariant.cpp | 15 | ||||
-rw-r--r-- | src/gui/math3d/qquaternion.cpp | 80 | ||||
-rw-r--r-- | src/gui/math3d/qquaternion.h | 22 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 28 | ||||
-rw-r--r-- | src/gui/painting/qpainter.h | 22 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 2 | ||||
-rw-r--r-- | src/gui/rhi/qrhi.cpp | 2 | ||||
-rw-r--r-- | src/gui/rhi/qshader.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_p.h | 2 |
10 files changed, 158 insertions, 30 deletions
diff --git a/src/gui/compat/removed_api.cpp b/src/gui/compat/removed_api.cpp index 6a39d8b8615..33549a06504 100644 --- a/src/gui/compat/removed_api.cpp +++ b/src/gui/compat/removed_api.cpp @@ -88,3 +88,16 @@ void QWindowSystemInterface::handleContextMenuEvent(QWindow *window, bool mouseT // order sections alphabetically #endif // QT_GUI_REMOVED_SINCE(6, 8) + +#if QT_GUI_REMOVED_SINCE(6, 11) + +#include "qpainter.h" // inlined API + +#include "qquaternion.h" // inlined API + + +// #include "qotherheader.h" +// // implement removed functions from qotherheader.h +// order sections alphabetically + +#endif // QT_GUI_REMOVED_SINCE(6, 11) diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index c6462dfed7b..6da0c4d387b 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -52,14 +52,13 @@ QT_BEGIN_NAMESPACE namespace { - -// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class struct QVariantGuiHelper : QMetaTypeModuleHelper { #define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \ QT_METATYPE_INTERFACE_INIT(RealName), - const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override { + static const QtPrivate::QMetaTypeInterface *interfaceForType(int type) + { switch (type) { QT_FOR_EACH_STATIC_GUI_CLASS(QT_METATYPE_CONVERT_ID_TO_TYPE) default: return nullptr; @@ -67,7 +66,7 @@ struct QVariantGuiHelper : QMetaTypeModuleHelper } #undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES - bool convert(const void *from, int fromTypeId, void *to, int toTypeId) const override + static bool convert(const void *from, int fromTypeId, void *to, int toTypeId) { Q_ASSERT(fromTypeId != toTypeId); @@ -133,14 +132,14 @@ struct QVariantGuiHelper : QMetaTypeModuleHelper return false; } }; - -static constexpr QVariantGuiHelper qVariantGuiHelper; - } // namespace used to hide QVariant handler void qRegisterGuiVariant() { - qMetaTypeGuiHelper = &qVariantGuiHelper; + qMetaTypeGuiHelper = QMetaTypeModuleHelper{ + &QVariantGuiHelper::interfaceForType, + &QVariantGuiHelper::convert, + }; } Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant) diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index b91215fdf4a..99061fb7163 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -557,7 +557,7 @@ QQuaternion QQuaternion::fromEulerAngles(float pitch, float yaw, float roll) \note If this quaternion is not normalized, the resulting rotation matrix will contain scaling information. - \sa fromRotationMatrix(), getAxes() + \sa fromRotationMatrix(), toAxes() */ QMatrix3x3 QQuaternion::toRotationMatrix() const { @@ -640,8 +640,63 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3) #ifndef QT_NO_VECTOR3D /*! + \since 6.11 + \class QQuaternion::Axes + \ingroup painting-3D + \inmodule QtGui + + A struct containing the three orthonormal axes that define a + \l{QQuaternion}{quaternion}. + + + \sa QQuaternion::toAxes(), QQuaternion::fromAxes(Axes) +*/ + +/*! + \variable QQuaternion::Axes::x + + The x orthonormal axis that, together with \l{y} and \l{z}, defines a + quaternion. +*/ + +/*! + \variable QQuaternion::Axes::y + + The y orthonormal axis that, together with \l{x} and \l{z}, defines a + quaternion. +*/ + +/*! + \variable QQuaternion::Axes::z + + The z orthonormal axis that, together with \l{x} and \l{y}, defines a + quaternion. +*/ + +/*! + \since 6.11 + + Returns the three orthonormal axes that define this quaternion. + + \sa QQuaternion::Axes, fromAxes(QQuaternion::Axes), toRotationMatrix() +*/ +auto QQuaternion::toAxes() const -> Axes +{ + const QMatrix3x3 rot3x3(toRotationMatrix()); + + return { {rot3x3(0, 0), rot3x3(1, 0), rot3x3(2, 0)}, + {rot3x3(0, 1), rot3x3(1, 1), rot3x3(2, 1)}, + {rot3x3(0, 2), rot3x3(1, 2), rot3x3(2, 2)} }; +} + + +/*! + \fn void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const \since 5.5 + \obsolete + Use toAxes() instead. + Returns the 3 orthonormal axes (\a xAxis, \a yAxis, \a zAxis) defining the quaternion. All of \a xAxis, \a yAxis, and \a zAxis must be valid, non-\nullptr pointers, @@ -649,16 +704,6 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3) \sa fromAxes(), toRotationMatrix() */ -void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const -{ - Q_ASSERT(xAxis && yAxis && zAxis); - - const QMatrix3x3 rot3x3(toRotationMatrix()); - - *xAxis = QVector3D(rot3x3(0, 0), rot3x3(1, 0), rot3x3(2, 0)); - *yAxis = QVector3D(rot3x3(0, 1), rot3x3(1, 1), rot3x3(2, 1)); - *zAxis = QVector3D(rot3x3(0, 2), rot3x3(1, 2), rot3x3(2, 2)); -} /*! \since 5.5 @@ -667,7 +712,7 @@ void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) \note The axes are assumed to be orthonormal. - \sa getAxes(), fromRotationMatrix() + \sa toAxes(), fromRotationMatrix() */ QQuaternion QQuaternion::fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis) { @@ -686,6 +731,17 @@ QQuaternion QQuaternion::fromAxes(const QVector3D &xAxis, const QVector3D &yAxis } /*! + \since 6.11 + \overload + + \sa toAxes(), fromRotationMatrix() +*/ +QQuaternion QQuaternion::fromAxes(Axes axes) // clazy:exclude=function-args-by-ref +{ + return fromAxes(axes.x, axes.y, axes.z); +} + +/*! \since 5.5 Constructs the quaternion using specified forward direction \a direction diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 0ea844ae41f..ffc95a852ce 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -118,7 +118,14 @@ QT_WARNING_POP QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromRotationMatrix(const QMatrix3x3 &rot3x3); #ifndef QT_NO_VECTOR3D - QT7_ONLY(Q_GUI_EXPORT) void getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const; + struct Axes + { + QVector3D x, y, z; + }; + QT7_ONLY(Q_GUI_EXPORT) Axes toAxes() const; + QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromAxes(Axes axes); // clazy:exclude=function-args-by-ref + QT_GUI_INLINE_SINCE(6, 11) + void getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const; QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis); @@ -330,6 +337,19 @@ QQuaternion QQuaternion::fromEulerAngles(const QVector3D &angles) return QQuaternion::fromEulerAngles(angles.x(), angles.y(), angles.z()); } +#if QT_GUI_INLINE_IMPL_SINCE(6, 11) +void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const +{ + Q_PRE(xAxis); + Q_PRE(yAxis); + Q_PRE(zAxis); + const Axes axes = toAxes(); + *xAxis = axes.x; + *yAxis = axes.y; + *zAxis = axes.z; +} +#endif // QT_GUI_INLINE_IMPL_SINCE(6, 11) + #endif // QT_NO_VECTOR3D constexpr void QQuaternion::setVector(float aX, float aY, float aZ) noexcept diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 5013e96f740..344bb8f1bef 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -41,6 +41,8 @@ #include <private/qrawfont_p.h> #include <private/qfont_p.h> +#include <QtCore/private/qtclasshelper_p.h> + QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; @@ -3652,6 +3654,8 @@ void QPainter::setPen(const QColor &color) } /*! + \fn void QPainter::setPen(const QPen &pen) + Sets the painter's pen to be the given \a pen. The \a pen defines how to draw lines and outlines, and it also @@ -3660,7 +3664,13 @@ void QPainter::setPen(const QColor &color) \sa pen(), {QPainter#Settings}{Settings} */ -void QPainter::setPen(const QPen &pen) +/*! + \fn void QPainter::setPen(QPen &&pen) + \since 6.11 + \overload +*/ + +void QPainter::doSetPen(const QPen &pen, QPen *rvalue) { #ifdef QT_DEBUG_DRAW @@ -3677,7 +3687,7 @@ void QPainter::setPen(const QPen &pen) if (d->state->pen == pen) return; - d->state->pen = pen; + q_choose_assign(d->state->pen, pen, rvalue); if (d->extended) { d->checkEmulation(); @@ -3733,6 +3743,8 @@ const QPen &QPainter::pen() const /*! + \fn void QPainter::setBrush(const QBrush &brush) + Sets the painter's brush to the given \a brush. The painter's brush defines how shapes are filled. @@ -3740,7 +3752,13 @@ const QPen &QPainter::pen() const \sa brush(), {QPainter#Settings}{Settings} */ -void QPainter::setBrush(const QBrush &brush) +/*! + \fn void QPainter::setBrush(QBrush &&brush) + \since 6.11 + \overload +*/ + +void QPainter::doSetBrush(const QBrush &brush, QBrush *rvalue) { #ifdef QT_DEBUG_DRAW if constexpr (qt_show_painter_debug_output) @@ -3756,13 +3774,13 @@ void QPainter::setBrush(const QBrush &brush) return; if (d->extended) { - d->state->brush = brush; + q_choose_assign(d->state->brush, brush, rvalue); d->checkEmulation(); d->extended->brushChanged(); return; } - d->state->brush = brush; + q_choose_assign(d->state->brush, brush, rvalue); d->state->dirtyFlags |= QPaintEngine::DirtyBrush; } diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 3c09b632364..83bde3b8cad 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -150,11 +150,15 @@ public: QFontInfo fontInfo() const; void setPen(const QColor &color); + QT_GUI_INLINE_SINCE(6, 11) void setPen(const QPen &pen); + void setPen(QPen &&pen) { doSetPen(pen, &pen); } void setPen(Qt::PenStyle style); const QPen &pen() const; + QT_GUI_INLINE_SINCE(6, 11) void setBrush(const QBrush &brush); + void setBrush(QBrush &&brush) { doSetBrush(brush, &brush); } void setBrush(Qt::BrushStyle style); void setBrush(QColor color); void setBrush(Qt::GlobalColor color) { setBrush(QColor(color)); } @@ -419,6 +423,9 @@ public: private: Q_DISABLE_COPY(QPainter) + void doSetPen(const QPen &lvalue, QPen *rvalue); + void doSetBrush(const QBrush &lvalue, QBrush *rvalue); + std::unique_ptr<QPainterPrivate> d_ptr; friend class QWidget; @@ -700,6 +707,21 @@ inline void QPainter::fillRect(const QRectF &r, QGradient::Preset p) fillRect(r, QGradient(p)); } +#if QT_GUI_INLINE_IMPL_SINCE(6, 11) + +void QPainter::setPen(const QPen &p) +{ + doSetPen(p, nullptr); +} + +void QPainter::setBrush(const QBrush &b) +{ + doSetBrush(b, nullptr); +} + +#endif // QT_GUI_INLINE_IMPL_SINCE(6, 11) + + inline void QPainter::setBrushOrigin(int x, int y) { setBrushOrigin(QPoint(x, y)); diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 66f1cf2a985..148d40b8361 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -784,7 +784,7 @@ bool QTransform::operator==(const QTransform &o) const */ size_t qHash(const QTransform &key, size_t seed) noexcept { - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, key.m11()); seed = hash(seed, key.m12()); seed = hash(seed, key.m21()); diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index b9312f6b304..7a3d4974e53 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -6543,7 +6543,7 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept { const QRhiShaderResourceBinding::Data *d = QRhiImplementation::shaderResourceBindingData(b); - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, d->binding); seed = hash(seed, d->stage); seed = hash(seed, d->type); diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index 5e967c62e40..1234d01b6ec 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -812,7 +812,7 @@ bool operator==(const QShader &lhs, const QShader &rhs) noexcept size_t qHash(const QShader &s, size_t seed) noexcept { if (s.d) { - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, s.stage()); if (!s.d->shaders.isEmpty()) { seed = hash(seed, s.d->shaders.firstKey()); diff --git a/src/gui/text/qfontdatabase_p.h b/src/gui/text/qfontdatabase_p.h index 4cd6996aab8..27fb34aecdd 100644 --- a/src/gui/text/qfontdatabase_p.h +++ b/src/gui/text/qfontdatabase_p.h @@ -51,7 +51,7 @@ inline bool operator!=(const QtFontFallbacksCacheKey &lhs, const QtFontFallbacks inline size_t qHash(const QtFontFallbacksCacheKey &key, size_t seed = 0) noexcept { - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, key.family); seed = hash(seed, int(key.style)); seed = hash(seed, int(key.styleHint)); |