From 73d1476fb1397948a4d806bd921fce372bd8d63b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Dec 2019 17:54:48 +0100 Subject: Replace most use of QVariant::type and occurrences of QVariant::Type I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll --- src/gui/math3d/qmatrix4x4.cpp | 2 +- src/gui/math3d/qquaternion.cpp | 2 +- src/gui/math3d/qvector2d.cpp | 2 +- src/gui/math3d/qvector3d.cpp | 2 +- src/gui/math3d/qvector4d.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/gui/math3d') diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index ad4cdfdbf4..6666eb037f 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -2007,7 +2007,7 @@ void QMatrix4x4::optimize() */ QMatrix4x4::operator QVariant() const { - return QVariant(QVariant::Matrix4x4, this); + return QVariant(QMetaType::QMatrix4x4, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 899ec12eb3..5f15949c5b 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -983,7 +983,7 @@ QQuaternion QQuaternion::nlerp */ QQuaternion::operator QVariant() const { - return QVariant(QVariant::Quaternion, this); + return QVariant(QMetaType::QQuaternion, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index c04f8b1cbf..5f651cf376 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -531,7 +531,7 @@ QVector4D QVector2D::toVector4D() const */ QVector2D::operator QVariant() const { - return QVariant(QVariant::Vector2D, this); + return QVariant(QMetaType::QVector2D, this); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 4f72c1da66..08c3de99d2 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -706,7 +706,7 @@ QVector4D QVector3D::toVector4D() const */ QVector3D::operator QVariant() const { - return QVariant(QVariant::Vector3D, this); + return QVariant(QMetaType::QVector3D, this); } /*! diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index 3a68bd6cb7..070ea7454e 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -608,7 +608,7 @@ QVector3D QVector4D::toVector3DAffine() const */ QVector4D::operator QVariant() const { - return QVariant(QVariant::Vector4D, this); + return QVariant(QMetaType::QVector4D, this); } #ifndef QT_NO_DEBUG_STREAM -- cgit v1.2.3 From b5193881e54ec3f3fe496654d23584eb5f96b692 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 24 Jan 2020 15:05:46 +0100 Subject: Make QMatrix4x4::projectedRotate public The function is used by QGraphicsRotation, which is in widgets. QGraphicsRotation is marked as a friend, so that it can access the private method. QtQuick needs access to the same method, so internally it declares a "fake" QGraphicsRotation class, just so that it can private access. This breaks now that QtQuick needs to do QT += opengl, which implies widgets and thus ends up including the header file that also declares QGraphicsRotation. So instead of these hacks, let's make the function public, but remain \internal in terms of docs. Change-Id: I671f68c9d7ab0aac985e0b583f63f3ee962567dc Reviewed-by: Jarek Kobus Reviewed-by: Laszlo Agocs --- src/gui/math3d/qmatrix4x4.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/gui/math3d') diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 1439bfac59..4ad6cceaea 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -187,6 +187,7 @@ public: friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m); #endif + void projectedRotate(float angle, float x, float y, float z); private: float m[4][4]; // Column-major order to match OpenGL. int flagBits; // Flag bits from the enum below. @@ -206,10 +207,6 @@ private: explicit QMatrix4x4(int) { } QMatrix4x4 orthonormalInverse() const; - - void projectedRotate(float angle, float x, float y, float z); - - friend class QGraphicsRotation; }; QT_WARNING_PUSH -- cgit v1.2.3 From 4bb897a3841f0f79150787e29fe122e1410bc119 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 10 Jan 2020 10:08:37 +0100 Subject: Deprecate all methods that use QMatrix Don't use QMatrix in implementation classes anymore. Task-number: QTBUG-46653 Fixes: QTBUG-81627 Change-Id: I4806c1302e42645dc6a608062c8d9c336ae8629b Reviewed-by: Leena Miettinen Reviewed-by: Laszlo Agocs Reviewed-by: Lars Knoll --- src/gui/math3d/qmatrix4x4.cpp | 10 ++++++++++ src/gui/math3d/qmatrix4x4.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src/gui/math3d') diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 6666eb037f..cdaed788e9 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -187,7 +187,10 @@ QMatrix4x4::QMatrix4x4(const float *values, int cols, int rows) flagBits = General; } +#if QT_DEPRECATED_SINCE(5, 15) /*! + \obsolete + Constructs a 4x4 matrix from a conventional Qt 2D affine transformation \a matrix. @@ -218,6 +221,7 @@ QMatrix4x4::QMatrix4x4(const QMatrix& matrix) m[3][3] = 1.0f; flagBits = Translation | Scale | Rotation2D; } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Constructs a 4x4 matrix from the conventional Qt 2D @@ -1659,7 +1663,12 @@ void QMatrix4x4::copyDataTo(float *values) const values[row * 4 + col] = float(m[col][row]); } +#if QT_DEPRECATED_SINCE(5, 15) /*! + \obsolete + + Use toTransform() instead. + Returns the conventional Qt 2D affine transformation matrix that corresponds to this matrix. It is assumed that this matrix only contains 2D affine transformation elements. @@ -1672,6 +1681,7 @@ QMatrix QMatrix4x4::toAffine() const m[1][0], m[1][1], m[3][0], m[3][1]); } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Returns the conventional Qt 2D transformation matrix that diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 1439bfac59..6a726a197c 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -72,7 +72,9 @@ public: QMatrix4x4(const float *values, int cols, int rows); QMatrix4x4(const QTransform& transform); +#if QT_DEPRECATED_SINCE(5, 15) QMatrix4x4(const QMatrix& matrix); +#endif // QT_DEPRECATED_SINCE(5, 15) inline const float& operator()(int row, int column) const; inline float& operator()(int row, int column); @@ -156,7 +158,9 @@ public: void copyDataTo(float *values) const; - QMatrix toAffine() const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use toTransform()") QMatrix toAffine() const; +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform toTransform() const; QTransform toTransform(float distanceToPlane) const; -- cgit v1.2.3