build fix for the case when QT_NO_QUATERNION is defined

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-02-26 02:05:05 +02:00
parent ffaf285148
commit 64e61d523f
8 changed files with 39 additions and 2 deletions

View file

@ -166,7 +166,6 @@
#cmakedefine QT_NO_PRINTPREVIEWDIALOG
#cmakedefine QT_NO_PRINTPREVIEWWIDGET
#cmakedefine QT_NO_PROGRESSDIALOG
#cmakedefine QT_NO_QFUTURE
#cmakedefine QT_NO_QUATERNION
#cmakedefine QT_NO_QUUID_STRING
#cmakedefine QT_NO_RESIZEHANDLER

View file

@ -1095,7 +1095,9 @@ bool QDeclarativeMetaType::canCopy(int type)
case QMetaType::QMatrix4x4:
case QMetaType::QVector2D:
case QMetaType::QVector4D:
#ifndef QT_NO_QUATERNION
case QMetaType::QQuaternion:
#endif
return true;
default:
@ -1304,9 +1306,11 @@ bool QDeclarativeMetaType::copy(int type, void *data, const void *copy)
case QMetaType::QVector4D:
*static_cast<NS(QVector4D) *>(data) = *static_cast<const NS(QVector4D)*>(copy);
return true;
#ifndef QT_NO_QUATERNION
case QMetaType::QQuaternion:
*static_cast<NS(QQuaternion) *>(data) = *static_cast<const NS(QQuaternion)*>(copy);
return true;
#endif // QT_NO_QUATERNION
default:
if (type == qMetaTypeId<QVariant>()) {
@ -1505,9 +1509,11 @@ bool QDeclarativeMetaType::copy(int type, void *data, const void *copy)
case QMetaType::QVector4D:
*static_cast<NS(QVector4D) *>(data) = NS(QVector4D)();
return true;
#ifndef QT_NO_QUATERNION
case QMetaType::QQuaternion:
*static_cast<NS(QQuaternion) *>(data) = NS(QQuaternion)();
return true;
#endif // QT_NO_QUATERNION
default:
if (type == qMetaTypeId<QVariant>()) {
*static_cast<NS(QVariant) *>(data) = NS(QVariant)();

View file

@ -114,9 +114,11 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
case QVariant::Vector4D:
rv = new QDeclarativeVector4DValueType;
break;
#ifndef QT_NO_QUATERNION
case QVariant::Quaternion:
rv = new QDeclarativeQuaternionValueType;
break;
#endif // QT_NO_QUATERNION
case QVariant::Matrix4x4:
rv = new QDeclarativeMatrix4x4ValueType;
break;
@ -641,6 +643,7 @@ void QDeclarativeVector4DValueType::setW(qreal w)
vector.setW(w);
}
#ifndef QT_NO_QUATERNION
QDeclarativeQuaternionValueType::QDeclarativeQuaternionValueType(QObject *parent)
: QDeclarativeValueType(parent)
{
@ -708,6 +711,7 @@ void QDeclarativeQuaternionValueType::setZ(qreal z)
{
quaternion.setZ(z);
}
#endif // QT_NO_QUATERNION
QDeclarativeMatrix4x4ValueType::QDeclarativeMatrix4x4ValueType(QObject *parent)
: QDeclarativeValueType(parent)

View file

@ -301,6 +301,7 @@ private:
QVector4D vector;
};
#ifndef QT_NO_QUATERNION
class Q_AUTOTEST_EXPORT QDeclarativeQuaternionValueType : public QDeclarativeValueType
{
Q_PROPERTY(qreal scalar READ scalar WRITE setScalar)
@ -328,6 +329,7 @@ public:
private:
QQuaternion quaternion;
};
#endif // QT_NO_QUATERNION
class Q_AUTOTEST_EXPORT QDeclarativeMatrix4x4ValueType : public QDeclarativeValueType
{

View file

@ -39,10 +39,12 @@ template<> Q_INLINE_TEMPLATE QColor _q_interpolate(const QColor &f,const QColor
qBound(0,_q_interpolate(f.alpha(), t.alpha(), progress),255));
}
#ifndef QT_NO_QUATERNION
template<> Q_INLINE_TEMPLATE QQuaternion _q_interpolate(const QQuaternion &f,const QQuaternion &t, qreal progress)
{
return QQuaternion::slerp(f, t, progress);
}
#endif // QT_NO_QUATERNION
static int qRegisterGuiGetInterpolator()
{
@ -50,7 +52,9 @@ static int qRegisterGuiGetInterpolator()
qRegisterAnimationInterpolator<QVector2D>(_q_interpolateVariant<QVector2D>);
qRegisterAnimationInterpolator<QVector3D>(_q_interpolateVariant<QVector3D>);
qRegisterAnimationInterpolator<QVector4D>(_q_interpolateVariant<QVector4D>);
#ifndef QT_NO_QUATERNION
qRegisterAnimationInterpolator<QQuaternion>(_q_interpolateVariant<QQuaternion>);
#endif // QT_NO_QUATERNION
return 1;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiGetInterpolator)
@ -66,8 +70,10 @@ static int qUnregisterGuiGetInterpolator()
(QVariant (*)(const QVector3D &, const QVector3D &, qreal))0);
qRegisterAnimationInterpolator<QVector4D>(
(QVariant (*)(const QVector4D &, const QVector4D &, qreal))0);
#ifndef QT_NO_QUATERNION
qRegisterAnimationInterpolator<QQuaternion>(
(QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0);
#endif // QT_NO_QUATERNION
return 1;
}

View file

@ -23,6 +23,8 @@
#include <QtCore/qmath.h>
#include <QtGui/qquaternion.h>
#ifndef QT_NO_QUATERNION
class tst_QQuaternion : public QObject
{
Q_OBJECT
@ -866,3 +868,9 @@ void tst_QQuaternion::metaTypes()
QTEST_APPLESS_MAIN(tst_QQuaternion)
#include "moc_tst_qquaternion.cpp"
#else QT_NO_QUATERNION
QTEST_NOOP_MAIN
#endif // QT_NO_QUATERNION

View file

@ -1353,6 +1353,7 @@ void tst_QVariant::vector4D()
void tst_QVariant::quaternion()
{
#ifndef QT_NO_QUATERNION
QVariant variant;
QQuaternion quaternion = qvariant_cast<QQuaternion>(variant);
QVERIFY(quaternion.isIdentity());
@ -1362,6 +1363,9 @@ void tst_QVariant::quaternion()
void *pquaternion = QMetaType::construct(QVariant::Quaternion, 0);
QVERIFY(pquaternion);
QMetaType::destroy(QVariant::Quaternion, pquaternion);
#else // QT_NO_QUATERNION
QSKIP("Katie compiled without quaternion support (QT_NO_QUATERNION)", SkipAll);
#endif // QT_NO_QUATERNION
}
void tst_QVariant::writeToReadFromDataStream_data()

View file

@ -22,7 +22,9 @@
#include <qtest.h>
#include <QQuaternion>
//TESTED_FILES=
#ifndef QT_NO_QUATERNION
// TESTED_FILES=
class tst_QQuaternion : public QObject
{
@ -104,3 +106,9 @@ void tst_QQuaternion::multiply()
QTEST_MAIN(tst_QQuaternion)
#include "moc_tst_qquaternion.cpp"
#else // QT_NO_QUATERNION
QTEST_NOOP_MAIN
#endif // QT_NO_QUATERNION