diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-07-20 15:46:40 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-26 15:01:04 +0200 |
commit | e083d253950d3e7ce1e6363cd29fba416e69e371 (patch) | |
tree | 7990f2da2be356bb4d6dd30190d3646524d816db /tests/auto/widgets | |
parent | f694b9c83fc4512228d5c9b3384bf7f2e03bb5d5 (diff) |
QMetaTypeId2::IsBuiltIn: (new) template meta-function to check for built-in types
This allows to check whether QMetaTypeId2::MetaType exists, and can help
turn run-time into compile-time expressions, even without constexpr support,
or in situations where constexpr can't be used (because you can't overload
on it). This was designed for the QMetaType::registerConversion feature,
but it's much more widely applicable.
Change-Id: Iafa04add04bcb531b3f7fe3e751c7e91ee6a3bc0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp index 9d2fd149f4..f92a4fd5cd 100644 --- a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp +++ b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp @@ -67,6 +67,12 @@ public: } }; +Q_STATIC_ASSERT(( QMetaTypeId2<QSizePolicy>::IsBuiltIn)); +Q_STATIC_ASSERT(( QMetaTypeId2<QWidget*>::IsBuiltIn)); +Q_STATIC_ASSERT((!QMetaTypeId2<QList<QSizePolicy> >::IsBuiltIn)); +Q_STATIC_ASSERT((!QMetaTypeId2<QMap<QString,QSizePolicy> >::IsBuiltIn)); + + void tst_QWidgetMetaType::metaObject() { QCOMPARE(QMetaType::metaObjectForType(QMetaType::QWidgetStar), &QWidget::staticMetaObject); |