Add QPolygonF to metatype system.

That was strange that QPolygon was know to QMetaType class but QPolygonF
not.

Change-Id: I67bb99644b8b1d0fe1aec730619d8048cb78219b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Jędrzej Nowacki 2011-10-26 13:48:40 +02:00 committed by Qt by Nokia
parent 8fd64d22ac
commit 5bd377274e
5 changed files with 13 additions and 5 deletions

View File

@ -142,6 +142,7 @@ QT_BEGIN_NAMESPACE
\value QTime QTime
\value QVariantList QVariantList
\value QPolygon QPolygon
\value QPolygonF QPolygonF
\value QColor QColor
\value QSizeF QSizeF
\value QRectF QRectF
@ -293,6 +294,7 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ
QT_ADD_STATIC_METATYPE("QVector3D", QMetaType::QVector3D),
QT_ADD_STATIC_METATYPE("QVector4D", QMetaType::QVector4D),
QT_ADD_STATIC_METATYPE("QQuaternion", QMetaType::QQuaternion),
QT_ADD_STATIC_METATYPE("QPolygonF", QMetaType::QPolygonF),
/* All Widgets types */
QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon),
@ -786,6 +788,7 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::QPalette:
case QMetaType::QImage:
case QMetaType::QPolygon:
case QMetaType::QPolygonF:
case QMetaType::QRegion:
case QMetaType::QBitmap:
case QMetaType::QCursor:
@ -992,6 +995,7 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::QPalette:
case QMetaType::QImage:
case QMetaType::QPolygon:
case QMetaType::QPolygonF:
case QMetaType::QRegion:
case QMetaType::QBitmap:
case QMetaType::QCursor:

View File

@ -135,6 +135,7 @@ QT_MODULE(Core)
F(QVector3D, 82, QVector3D) \
F(QVector4D, 83, QVector4D) \
F(QQuaternion, 84, QQuaternion) \
F(QPolygonF, 85, QPolygonF) \
#define QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\
F(QIcon, 120, QIcon) \
@ -185,7 +186,7 @@ public:
LastCoreType = QEasingCurve,
FirstGuiType = QFont,
LastGuiType = QQuaternion,
LastGuiType = QPolygonF,
FirstWidgetsType = QIcon,
LastWidgetsType = QSizePolicy,
FirstCoreExtType = VoidStar,

View File

@ -148,7 +148,8 @@ class Q_CORE_EXPORT QVariant
Vector3D = 82,
Vector4D = 83,
Quaternion = 84,
LastGuiType = Quaternion,
PolygonF = 85,
LastGuiType = PolygonF,
Icon = 120,
SizePolicy = 121,

View File

@ -549,6 +549,7 @@ Q_DECL_METATYPE_HELPER(QVector4D)
#ifndef QT_NO_QUATERNION
Q_DECL_METATYPE_HELPER(QQuaternion)
#endif
Q_DECL_METATYPE_HELPER(QPolygonF)
#ifdef QT_NO_DATASTREAM
# define Q_IMPL_METATYPE_HELPER(TYPE) \
@ -616,10 +617,11 @@ static const QMetaTypeGuiHelper qVariantGuiHelper[] = {
{0, 0, 0, 0, 0, 0, 0},
#endif
#ifndef QT_NO_QUATERNION
Q_IMPL_METATYPE_HELPER(QQuaternion)
Q_IMPL_METATYPE_HELPER(QQuaternion),
#else
{0, 0, 0, 0, 0, 0, 0}
{0, 0, 0, 0, 0, 0, 0},
#endif
Q_IMPL_METATYPE_HELPER(QPolygonF)
};
static const QVariant::Handler *qt_guivariant_last_handler = 0;

View File

@ -1914,7 +1914,7 @@ void tst_QVariant::typeToName()
QCOMPARE( QVariant::typeToName( v.type() ), (const char*)0 ); // Invalid
// assumes that QVariant::Type contains consecutive values
int max = QVariant::Quaternion;
int max = QVariant::LastGuiType;
for ( int t = 1; t <= max; t++ ) {
const char *n = QVariant::typeToName( (QVariant::Type)t );
if (n)