diff options
Diffstat (limited to 'src/widgets/kernel/qwidgetsvariant.cpp')
-rw-r--r-- | src/widgets/kernel/qwidgetsvariant.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 97a8238ca7..92c8d9e6c2 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE - +namespace { static void construct(QVariant::Private *x, const void *copy) { switch (x->type) { @@ -97,10 +97,8 @@ static bool isNull(const QVariant::Private *d) case QVariant::Icon: return v_cast<QIcon>(d)->isNull(); #endif - default: - Q_ASSERT(false); } - return true; + return false; } static bool compare(const QVariant::Private *a, const QVariant::Private *b) @@ -119,6 +117,15 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) return false; } +static bool convert(const QVariant::Private *d, QVariant::Type type, void *result, bool *ok) +{ + Q_UNUSED(d); + Q_UNUSED(type); + Q_UNUSED(result); + if (ok) + *ok = false; + return false; +} static const QVariant::Handler widgets_handler = { construct, @@ -129,7 +136,7 @@ static const QVariant::Handler widgets_handler = { 0, #endif compare, - 0, + convert, 0, #if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM) 0 @@ -138,8 +145,6 @@ static const QVariant::Handler widgets_handler = { #endif }; -extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper; - #define QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES(MetaTypeName, MetaTypeId, RealName) \ QT_METATYPE_INTERFACE_INIT(RealName), @@ -149,18 +154,20 @@ static const QMetaTypeInterface qVariantWidgetsHelper[] = { #undef QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES -extern Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler; +} // namespace + +extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper; void qRegisterWidgetsVariant() { - qt_widgets_variant_handler = &widgets_handler; qMetaTypeWidgetsHelper = qVariantWidgetsHelper; + QVariantPrivate::registerHandler(QModulesPrivate::Widgets, &widgets_handler); } Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant) void qUnregisterWidgetsVariant() { - qt_widgets_variant_handler = 0; + QVariantPrivate::unregisterHandler(QModulesPrivate::Widgets); qMetaTypeWidgetsHelper = 0; } Q_DESTRUCTOR_FUNCTION(qUnregisterWidgetsVariant) |