From 32ce4fe9e6a94e77828e976776cf08da85254ff2 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 May 2011 23:52:43 +0200 Subject: split up qguivariant into two files Move everything that will end up in QtWidgets into a qwidgetsvariant.cpp file. Currently this is QIcon and QSizePolicy only. --- src/corelib/kernel/qmetatype.cpp | 41 +++++-- src/corelib/kernel/qmetatype.h | 19 +-- src/corelib/kernel/qvariant.h | 45 +++---- src/gui/guikernel/qguivariant.cpp | 59 ++++----- src/gui/kernel/kernel.pri | 5 +- src/gui/kernel/qwidgetsvariant.cpp | 213 +++++++++++++++++++++++++++++++++ tests/auto/qmetatype/tst_qmetatype.cpp | 1 - tests/auto/qvariant/tst_qvariant.cpp | 4 - 8 files changed, 301 insertions(+), 86 deletions(-) create mode 100644 src/gui/kernel/qwidgetsvariant.cpp diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index bdc96c638b..97afe5965a 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -265,19 +265,16 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ QT_ADD_STATIC_METATYPE("QEasingCurve", QMetaType::QEasingCurve), /* All GUI types */ - QT_ADD_STATIC_METATYPE("QColorGroup", 63), QT_ADD_STATIC_METATYPE("QFont", QMetaType::QFont), QT_ADD_STATIC_METATYPE("QPixmap", QMetaType::QPixmap), QT_ADD_STATIC_METATYPE("QBrush", QMetaType::QBrush), QT_ADD_STATIC_METATYPE("QColor", QMetaType::QColor), QT_ADD_STATIC_METATYPE("QPalette", QMetaType::QPalette), - QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon), QT_ADD_STATIC_METATYPE("QImage", QMetaType::QImage), QT_ADD_STATIC_METATYPE("QPolygon", QMetaType::QPolygon), QT_ADD_STATIC_METATYPE("QRegion", QMetaType::QRegion), QT_ADD_STATIC_METATYPE("QBitmap", QMetaType::QBitmap), QT_ADD_STATIC_METATYPE("QCursor", QMetaType::QCursor), - QT_ADD_STATIC_METATYPE("QSizePolicy", QMetaType::QSizePolicy), QT_ADD_STATIC_METATYPE("QKeySequence", QMetaType::QKeySequence), QT_ADD_STATIC_METATYPE("QPen", QMetaType::QPen), QT_ADD_STATIC_METATYPE("QTextLength", QMetaType::QTextLength), @@ -290,6 +287,10 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ QT_ADD_STATIC_METATYPE("QVector4D", QMetaType::QVector4D), QT_ADD_STATIC_METATYPE("QQuaternion", QMetaType::QQuaternion), + /* All Widgets types */ + QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon), + QT_ADD_STATIC_METATYPE("QSizePolicy", QMetaType::QSizePolicy), + /* All Metatype builtins */ QT_ADD_STATIC_METATYPE("void*", QMetaType::VoidStar), QT_ADD_STATIC_METATYPE("long", QMetaType::Long), @@ -338,6 +339,7 @@ struct QMetaTypeGuiHelper #endif }; Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeGuiHelper = 0; +Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeWidgetsHelper = 0; class QCustomTypeInfo { @@ -399,14 +401,17 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, */ const char *QMetaType::typeName(int type) { - enum { GuiTypeCount = LastGuiType - FirstGuiType }; + enum { GuiTypeCount = LastGuiType - FirstGuiType, + WidgetsTypeCount = LastWidgetsType - FirstWidgetsType }; if (type >= 0 && type <= LastCoreType) { return types[type].typeName; } else if (type >= FirstGuiType && type <= LastGuiType) { return types[type - FirstGuiType + LastCoreType + 1].typeName; + } else if (type >= FirstWidgetsType && type <= LastWidgetsType) { + return types[type - FirstWidgetsType + GuiTypeCount + LastCoreType + 2].typeName; } else if (type >= FirstCoreExtType && type <= LastCoreExtType) { - return types[type - FirstCoreExtType + GuiTypeCount + LastCoreType + 2].typeName; + return types[type - FirstCoreExtType + GuiTypeCount + WidgetsTypeCount + LastCoreType + 3].typeName; } else if (type >= User) { const QVector * const ct = customTypes(); QReadLocker locker(customTypesLock()); @@ -768,13 +773,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) case QMetaType::QBrush: case QMetaType::QColor: case QMetaType::QPalette: - case QMetaType::QIcon: case QMetaType::QImage: case QMetaType::QPolygon: case QMetaType::QRegion: case QMetaType::QBitmap: case QMetaType::QCursor: - case QMetaType::QSizePolicy: case QMetaType::QKeySequence: case QMetaType::QPen: case QMetaType::QTextLength: @@ -790,6 +793,12 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) return false; qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data); break; + case QMetaType::QIcon: + case QMetaType::QSizePolicy: + if (!qMetaTypeWidgetsHelper) + return false; + qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data); + break; default: { const QVector * const ct = customTypes(); if (!ct) @@ -973,13 +982,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) case QMetaType::QBrush: case QMetaType::QColor: case QMetaType::QPalette: - case QMetaType::QIcon: case QMetaType::QImage: case QMetaType::QPolygon: case QMetaType::QRegion: case QMetaType::QBitmap: case QMetaType::QCursor: - case QMetaType::QSizePolicy: case QMetaType::QKeySequence: case QMetaType::QPen: case QMetaType::QTextLength: @@ -995,6 +1002,12 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) return false; qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data); break; + case QMetaType::QIcon: + case QMetaType::QSizePolicy: + if (!qMetaTypeWidgetsHelper) + return false; + qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data); + break; default: { const QVector * const ct = customTypes(); if (!ct) @@ -1224,6 +1237,10 @@ void *QMetaType::construct(int type, const void *copy) if (!qMetaTypeGuiHelper) return 0; constr = qMetaTypeGuiHelper[type - FirstGuiType].constr; + } else if (type >= FirstWidgetsType && type <= LastWidgetsType) { + if (!qMetaTypeWidgetsHelper) + return 0; + constr = qMetaTypeWidgetsHelper[type - FirstWidgetsType].constr; } else { const QVector * const ct = customTypes(); QReadLocker locker(customTypesLock()); @@ -1386,6 +1403,12 @@ void QMetaType::destroy(int type, void *data) if (!qMetaTypeGuiHelper) return; destr = qMetaTypeGuiHelper[type - FirstGuiType].destr; + } else if (type >= FirstWidgetsType && type <= LastWidgetsType) { + Q_ASSERT(qMetaTypeWidgetsHelper); + + if (!qMetaTypeWidgetsHelper) + return; + destr = qMetaTypeWidgetsHelper[type - FirstWidgetsType].destr; } else { QReadLocker locker(customTypesLock()); if (type < User || !ct || ct->count() <= type - User) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index a2bb7d1597..8e7848aef0 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -71,18 +71,19 @@ public: QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27, QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve, - FirstGuiType = 63 /* QColorGroup */, -#ifdef QT3_SUPPORT - QColorGroup = 63, -#endif + FirstGuiType = 64 /* QFont */, QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68, - QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73, - QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77, - QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81, - QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85, - QQuaternion = 86, + QImage = 69, QPolygon = 70, QRegion = 71, QBitmap = 72, + QCursor = 73, QKeySequence = 74, QPen = 75, + QTextLength = 76, QTextFormat = 77, QMatrix = 78, QTransform = 79, + QMatrix4x4 = 80, QVector2D = 81, QVector3D = 82, QVector4D = 83, + QQuaternion = 84, LastGuiType = QQuaternion, + FirstWidgetsType = 120, /* QIcon */ + QIcon = 120, QSizePolicy = 121, + LastWidgetsType = QSizePolicy, + FirstCoreExtType = 128 /* VoidStar */, VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 1b8cb7fd0b..345272ee36 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -127,40 +127,33 @@ class Q_CORE_EXPORT QVariant LastCoreType = EasingCurve, // value 62 is internally reserved -#ifdef QT3_SUPPORT - ColorGroup = 63, -#endif Font = 64, Pixmap = 65, Brush = 66, Color = 67, Palette = 68, - Icon = 69, - Image = 70, - Polygon = 71, - Region = 72, - Bitmap = 73, - Cursor = 74, - SizePolicy = 75, - KeySequence = 76, - Pen = 77, - TextLength = 78, - TextFormat = 79, - Matrix = 80, - Transform = 81, - Matrix4x4 = 82, - Vector2D = 83, - Vector3D = 84, - Vector4D = 85, - Quaternion = 86, + Image = 69, + Polygon = 70, + Region = 71, + Bitmap = 72, + Cursor = 73, + KeySequence = 74, + Pen = 75, + TextLength = 76, + TextFormat = 77, + Matrix = 78, + Transform = 79, + Matrix4x4 = 80, + Vector2D = 81, + Vector3D = 82, + Vector4D = 83, + Quaternion = 84, LastGuiType = Quaternion, + Icon = 120, + SizePolicy = 121, + UserType = 127, -#ifdef QT3_SUPPORT - IconSet = Icon, - CString = ByteArray, - PointArray = Polygon, -#endif LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type }; diff --git a/src/gui/guikernel/qguivariant.cpp b/src/gui/guikernel/qguivariant.cpp index ef0cfc987c..c1e07e55a5 100644 --- a/src/gui/guikernel/qguivariant.cpp +++ b/src/gui/guikernel/qguivariant.cpp @@ -48,7 +48,6 @@ #include "qdatastream.h" #include "qdebug.h" #include "qfont.h" -#include "qicon.h" #include "qimage.h" #include "qkeysequence.h" #include "qtransform.h" @@ -58,7 +57,6 @@ #include "qpixmap.h" #include "qpolygon.h" #include "qregion.h" -#include "qsizepolicy.h" #include "qtextformat.h" #include "qmatrix4x4.h" #include "qvector2d.h" @@ -70,6 +68,7 @@ QT_BEGIN_NAMESPACE +Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler = 0; Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler(); @@ -103,11 +102,6 @@ static void construct(QVariant::Private *x, const void *copy) case QVariant::Palette: v_construct(x, copy); break; -#ifndef QT_NO_ICON - case QVariant::Icon: - v_construct(x, copy); - break; -#endif case QVariant::Matrix: v_construct(x, copy); break; @@ -128,9 +122,6 @@ static void construct(QVariant::Private *x, const void *copy) case QVariant::Pen: v_construct(x, copy); break; - case QVariant::SizePolicy: - v_construct(x, copy); - break; #ifndef QT_NO_CURSOR case QVariant::Cursor: v_construct(x, copy); @@ -169,6 +160,13 @@ static void construct(QVariant::Private *x, const void *copy) v_construct(x, copy); break; #endif + case QVariant::SizePolicy: + case QVariant::Icon: + if (qt_widgets_variant_handler) { + qt_widgets_variant_handler->construct(x, copy); + return; + } + break; default: qcoreVariantHandler()->construct(x, copy); return; @@ -209,11 +207,6 @@ static void clear(QVariant::Private *d) case QVariant::Palette: v_clear(d); break; -#ifndef QT_NO_ICON - case QVariant::Icon: - v_clear(d); - break; -#endif case QVariant::Matrix: v_clear(d); break; @@ -226,9 +219,6 @@ static void clear(QVariant::Private *d) case QVariant::TextLength: v_clear(d); break; - case QVariant::SizePolicy: - v_clear(d); - break; #ifndef QT_NO_SHORTCUT case QVariant::KeySequence: v_clear(d); @@ -262,6 +252,13 @@ static void clear(QVariant::Private *d) v_clear(d); break; #endif + case QVariant::SizePolicy: + case QVariant::Icon: + if (qt_widgets_variant_handler) { + qt_widgets_variant_handler->clear(d); + return; + } + break; default: qcoreVariantHandler()->clear(d); return; @@ -286,10 +283,6 @@ static bool isNull(const QVariant::Private *d) return v_cast(d)->isNull(); case QVariant::Image: return v_cast(d)->isNull(); -#ifndef QT_NO_ICON - case QVariant::Icon: - return v_cast(d)->isNull(); -#endif case QVariant::Matrix: case QVariant::TextFormat: case QVariant::TextLength: @@ -324,6 +317,10 @@ static bool isNull(const QVariant::Private *d) case QVariant::Quaternion: return v_cast(d)->isNull(); #endif + case QVariant::Icon: + if (qt_widgets_variant_handler) + return qt_widgets_variant_handler->isNull(d); + break; default: return qcoreVariantHandler()->isNull(d); } @@ -371,8 +368,6 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) return *v_cast(a) == *v_cast(b); case QVariant::TextLength: return *v_cast(a) == *v_cast(b); - case QVariant::SizePolicy: - return *v_cast(a) == *v_cast(b); #ifndef QT_NO_SHORTCUT case QVariant::KeySequence: return *v_cast(a) == *v_cast(b); @@ -399,6 +394,10 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) case QVariant::Quaternion: return *v_cast(a) == *v_cast(b); #endif + case QVariant::SizePolicy: + if (qt_widgets_variant_handler) + return qt_widgets_variant_handler->compare(a, b); + break; default: break; } @@ -672,9 +671,6 @@ Q_DECL_METATYPE_HELPER(QPixmap) Q_DECL_METATYPE_HELPER(QBrush) Q_DECL_METATYPE_HELPER(QColor) Q_DECL_METATYPE_HELPER(QPalette) -#ifndef QT_NO_ICON -Q_DECL_METATYPE_HELPER(QIcon) -#endif Q_DECL_METATYPE_HELPER(QImage) Q_DECL_METATYPE_HELPER(QPolygon) Q_DECL_METATYPE_HELPER(QRegion) @@ -682,7 +678,6 @@ Q_DECL_METATYPE_HELPER(QBitmap) #ifndef QT_NO_CURSOR Q_DECL_METATYPE_HELPER(QCursor) #endif -Q_DECL_METATYPE_HELPER(QSizePolicy) #ifndef QT_NO_SHORTCUT Q_DECL_METATYPE_HELPER(QKeySequence) #endif @@ -721,17 +716,11 @@ Q_DECL_METATYPE_HELPER(QQuaternion) #endif static const QMetaTypeGuiHelper qVariantGuiHelper[] = { - {0, 0, 0, 0}, Q_IMPL_METATYPE_HELPER(QFont), Q_IMPL_METATYPE_HELPER(QPixmap), Q_IMPL_METATYPE_HELPER(QBrush), Q_IMPL_METATYPE_HELPER(QColor), Q_IMPL_METATYPE_HELPER(QPalette), -#ifdef QT_NO_ICON - {0, 0, 0, 0}, -#else - Q_IMPL_METATYPE_HELPER(QIcon), -#endif Q_IMPL_METATYPE_HELPER(QImage), Q_IMPL_METATYPE_HELPER(QPolygon), Q_IMPL_METATYPE_HELPER(QRegion), @@ -741,7 +730,6 @@ static const QMetaTypeGuiHelper qVariantGuiHelper[] = { #else Q_IMPL_METATYPE_HELPER(QCursor), #endif - Q_IMPL_METATYPE_HELPER(QSizePolicy), #ifdef QT_NO_SHORTCUT {0, 0, 0, 0}, #else @@ -797,4 +785,5 @@ int qUnregisterGuiVariant() } Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant) + QT_END_NAMESPACE diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 4788252285..d085bff146 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -67,8 +67,9 @@ SOURCES += \ kernel/qgesturerecognizer.cpp \ kernel/qgesturemanager.cpp \ kernel/qsoftkeymanager.cpp \ - kernel/qdesktopwidget.cpp \ - kernel/qguiplatformplugin.cpp + kernel/qdesktopwidget.cpp \ + kernel/qguiplatformplugin.cpp \ + kernel/qwidgetsvariant.cpp win32 { DEFINES += QT_NO_DIRECTDRAW diff --git a/src/gui/kernel/qwidgetsvariant.cpp b/src/gui/kernel/qwidgetsvariant.cpp new file mode 100644 index 0000000000..680c8f9cfa --- /dev/null +++ b/src/gui/kernel/qwidgetsvariant.cpp @@ -0,0 +1,213 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvariant.h" + +#include "qicon.h" +#include "qsizepolicy.h" + +#include "private/qvariant_p.h" + +QT_BEGIN_NAMESPACE + + +static void construct(QVariant::Private *x, const void *copy) +{ + switch (x->type) { +#ifndef QT_NO_ICON + case QVariant::Icon: + v_construct(x, copy); + break; +#endif + case QVariant::SizePolicy: + v_construct(x, copy); + break; + default: + Q_ASSERT(false); + return; + } + x->is_null = !copy; +} + +static void clear(QVariant::Private *d) +{ + switch (d->type) { +#ifndef QT_NO_ICON + case QVariant::Icon: + v_clear(d); + break; +#endif + case QVariant::SizePolicy: + v_clear(d); + break; + default: + Q_ASSERT(false); + return; + } + + d->type = QVariant::Invalid; + d->is_null = true; + d->is_shared = false; +} + + +static bool isNull(const QVariant::Private *d) +{ + switch(d->type) { +#ifndef QT_NO_ICON + case QVariant::Icon: + return v_cast(d)->isNull(); +#endif + default: + Q_ASSERT(false); + } + return true; +} + +static bool compare(const QVariant::Private *a, const QVariant::Private *b) +{ + Q_ASSERT(a->type == b->type); + switch(a->type) { + case QVariant::SizePolicy: + return *v_cast(a) == *v_cast(b); + default: + Q_ASSERT(false); + } + return false; +} + + +static const QVariant::Handler widgets_handler = { + construct, + clear, + isNull, +#ifndef QT_NO_DATASTREAM + 0, + 0, +#endif + compare, + 0, + 0, +#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM) + 0 +#else + 0 +#endif +}; + +struct QMetaTypeGuiHelper +{ + QMetaType::Constructor constr; + QMetaType::Destructor destr; +#ifndef QT_NO_DATASTREAM + QMetaType::SaveOperator saveOp; + QMetaType::LoadOperator loadOp; +#endif +}; + +extern Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeWidgetsHelper; + + +#ifdef QT_NO_DATASTREAM +# define Q_DECL_METATYPE_HELPER(TYPE) \ + typedef void *(*QConstruct##TYPE)(const TYPE *); \ + static const QConstruct##TYPE qConstruct##TYPE = qMetaTypeConstructHelper; \ + typedef void (*QDestruct##TYPE)(TYPE *); \ + static const QDestruct##TYPE qDestruct##TYPE = qMetaTypeDeleteHelper; +#else +# define Q_DECL_METATYPE_HELPER(TYPE) \ + typedef void *(*QConstruct##TYPE)(const TYPE *); \ + static const QConstruct##TYPE qConstruct##TYPE = qMetaTypeConstructHelper; \ + typedef void (*QDestruct##TYPE)(TYPE *); \ + static const QDestruct##TYPE qDestruct##TYPE = qMetaTypeDeleteHelper; \ + typedef void (*QSave##TYPE)(QDataStream &, const TYPE *); \ + static const QSave##TYPE qSave##TYPE = qMetaTypeSaveHelper; \ + typedef void (*QLoad##TYPE)(QDataStream &, TYPE *); \ + static const QLoad##TYPE qLoad##TYPE = qMetaTypeLoadHelper; +#endif + +#ifndef QT_NO_ICON +Q_DECL_METATYPE_HELPER(QIcon) +#endif +Q_DECL_METATYPE_HELPER(QSizePolicy) + +#ifdef QT_NO_DATASTREAM +# define Q_IMPL_METATYPE_HELPER(TYPE) \ + { reinterpret_cast(qConstruct##TYPE), \ + reinterpret_cast(qDestruct##TYPE) } +#else +# define Q_IMPL_METATYPE_HELPER(TYPE) \ + { reinterpret_cast(qConstruct##TYPE), \ + reinterpret_cast(qDestruct##TYPE), \ + reinterpret_cast(qSave##TYPE), \ + reinterpret_cast(qLoad##TYPE) \ + } +#endif + +static const QMetaTypeGuiHelper qVariantWidgetsHelper[] = { +#ifdef QT_NO_ICON + {0, 0, 0, 0}, +#else + Q_IMPL_METATYPE_HELPER(QIcon), +#endif + Q_IMPL_METATYPE_HELPER(QSizePolicy), +}; + +extern Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler; + +int qRegisterWidgetsVariant() +{ + qt_widgets_variant_handler = &widgets_handler; + qMetaTypeWidgetsHelper = qVariantWidgetsHelper; + return 1; +} +Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant) + +int qUnregisterWidgetsVariant() +{ + qt_widgets_variant_handler = 0; + qMetaTypeWidgetsHelper = 0; + return 1; +} +Q_DESTRUCTOR_FUNCTION(qUnregisterWidgetsVariant) + + +QT_END_NAMESPACE diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp index 67bbac217a..9872682f89 100644 --- a/tests/auto/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/qmetatype/tst_qmetatype.cpp @@ -224,7 +224,6 @@ void tst_QMetaType::typeName_data() QTest::newRow("double") << QMetaType::Double << "double"; QTest::newRow("qlonglong") << QMetaType::LongLong << "qlonglong"; QTest::newRow("QRegExp") << QMetaType::QRegExp << "QRegExp"; - QTest::newRow("QColorGroup") << QMetaType::Type(63) << "QColorGroup"; QTest::newRow("void*") << QMetaType::VoidStar << "void*"; QTest::newRow("ulong") << QMetaType::ULong << "ulong"; QTest::newRow("QWidget*") << QMetaType::QWidgetStar << "QWidget*"; diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 6ebe84ea4e..d3438ca3d1 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -2028,10 +2028,6 @@ void tst_QVariant::typeName_data() QTest::newRow("9") << int(QVariant::Size) << QByteArray("QSize"); QTest::newRow("10") << int(QVariant::Color) << QByteArray("QColor"); QTest::newRow("11") << int(QVariant::Palette) << QByteArray("QPalette"); -#ifdef QT3_SUPPORT - QTest::newRow("12") << int(QVariant::ColorGroup) << QByteArray("QColorGroup"); - QTest::newRow("13") << int(QVariant::IconSet) << QByteArray("QIcon"); -#endif QTest::newRow("14") << int(QVariant::Point) << QByteArray("QPoint"); QTest::newRow("15") << int(QVariant::Image) << QByteArray("QImage"); QTest::newRow("16") << int(QVariant::Int) << QByteArray("int"); -- cgit v1.2.3