From 863369deceeb254ea71724a247953fd0760ae30b Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 5 Nov 2009 14:26:32 +0100 Subject: [PATCH] API review: QMatrix::det() -> QMatrix::determinant(), matching math3d After an API review of the new math3d classes, the full name was considered better than the short version. Therefore we obsolete the short function, and introduce the longer version. Reviewed-by: Andreas Aardal Hanssen --- src/gui/painting/qmatrix.cpp | 18 ++++++++++++++---- src/gui/painting/qmatrix.h | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index 88b2b7aafa..17b7241926 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE which returns true if the matrix is non-singular (i.e. AB = BA = I). The inverted() function returns an inverted copy of \e this matrix if it is invertible (otherwise it returns the identity - matrix). In addition, QMatrix provides the det() function + matrix). In addition, QMatrix provides the determinant() function returning the matrix's determinant. Finally, the QMatrix class supports matrix multiplication, and @@ -959,9 +959,19 @@ QMatrix &QMatrix::rotate(qreal a) */ /*! + \obsolete \fn qreal QMatrix::det() const Returns the matrix's determinant. + + \sa determinant() +*/ + +/*! + \since 4.6 + \fn qreal QMatrix::determinant() const + + Returns the matrix's determinant. */ /*! @@ -985,8 +995,8 @@ QMatrix &QMatrix::rotate(qreal a) QMatrix QMatrix::inverted(bool *invertible) const { - qreal determinant = det(); - if (determinant == 0.0) { + qreal dtr = determinant(); + if (dtr == 0.0) { if (invertible) *invertible = false; // singular matrix return QMatrix(true); @@ -994,7 +1004,7 @@ QMatrix QMatrix::inverted(bool *invertible) const else { // invertible matrix if (invertible) *invertible = true; - qreal dinv = 1.0/determinant; + qreal dinv = 1.0/dtr; return QMatrix((_m22*dinv), (-_m12*dinv), (-_m21*dinv), (_m11*dinv), ((_m21*_dy - _m22*_dx)*dinv), diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 8887f0ef7c..152b3c9b40 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -101,7 +101,8 @@ public: QMatrix &rotate(qreal a); bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); } - qreal det() const { return _m11*_m22 - _m12*_m21; } + qreal determinant() const { return _m11*_m22 - _m12*_m21; } + QT_DEPRECATED qreal det() const { return _m11*_m22 - _m12*_m21; } QMatrix inverted(bool *invertible = 0) const; -- 2.11.4.GIT