- QMetaType:
* QMetaType::construct() has been renamed to QMetaType::create().
* QMetaType::unregisterType() has been removed.
+ * QMetaType::QWidgetStar has been removed. Use qMetaTypeId<QWidget*>()
+ or QVariant::canConvert<QWidget*>() as appropriate.
- QMetaMethod:
* QMetaMethod::signature() has been renamed to QMetaMethod::methodSignature(),
\value UChar \c{unsigned char}
\value Float \c float
\value QObjectStar QObject *
- \value QWidgetStar QWidget *
\value QVariant QVariant
\value QCursor QCursor
bool QMetaType::isRegistered(int type)
{
// predefined type
- if ((type >= FirstCoreType && type <= LastCoreType)
+ if ((type >= FirstCoreType && type <= LastCoreType && type != 40) // 40 is the type that QWidgetStar used to be
|| (type >= FirstGuiType && type <= LastGuiType)
|| (type >= FirstWidgetsType && type <= LastWidgetsType)) {
return true;
case QMetaType::Void:
case QMetaType::VoidStar:
case QMetaType::QObjectStar:
- case QMetaType::QWidgetStar:
case QMetaType::QModelIndex:
case QMetaType::QJsonValue:
case QMetaType::QJsonObject:
case QMetaType::Void:
case QMetaType::VoidStar:
case QMetaType::QObjectStar:
- case QMetaType::QWidgetStar:
case QMetaType::QModelIndex:
case QMetaType::QJsonValue:
case QMetaType::QJsonObject:
F(QJsonDocument, 48, QJsonDocument) \
#define QT_FOR_EACH_STATIC_CORE_POINTER(F)\
- F(QObjectStar, 39, QObject*) \
- F(QWidgetStar, 40, QWidget*) \
+ F(QObjectStar, 39, QObject*)
#define QT_FOR_EACH_STATIC_CORE_TEMPLATE(F)\
F(QVariantMap, 8, QVariantMap) \
QRegularExpression = 44,
QJsonValue = 45, QJsonObject = 46, QJsonArray = 47, QJsonDocument = 48,
SChar = 49,
- QObjectStar = 39, QWidgetStar = 40,
+ QObjectStar = 39,
Void = 43,
QVariantMap = 8, QVariantList = 9, QVariantHash = 28,
QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68,
{
enum { Value = true };
};
- template<>
- struct IsPointerToTypeDerivedFromQObject<QWidget*>
- {
- enum { Value = true };
- };
template<typename T>
struct IsPointerToTypeDerivedFromQObject<T*>
static inline const QMetaObject *value() { return &T::staticMetaObject; }
};
- Q_CORE_EXPORT const QMetaObject *metaObjectForQWidget();
-
- template<>
- struct MetaObjectForType<QWidget*, /* isPointerToTypeDerivedFromQObject = */ true>
- {
- static const QMetaObject *value() { return metaObjectForQWidget(); }
- };
-
template<typename T>
struct IsSharedPointerToTypeDerivedFromQObject
{
Usually, you never have to use this constructor, use QVariant::fromValue()
instead to construct variants from the pointer types represented by
- \c QMetaType::VoidStar, \c QMetaType::QObjectStar and
- \c QMetaType::QWidgetStar.
+ \c QMetaType::VoidStar, and \c QMetaType::QObjectStar.
\sa QVariant::fromValue(), Type
*/
case QMetaType::Short:
case QMetaType::UShort:
return qCanConvertMatrix[QVariant::Int] & (1 << currentType) || currentType == QVariant::Int;
- case QMetaType::QWidgetStar:
case QMetaType::QObjectStar:
return canConvertMetaObject(currentType, targetTypeId, d.data.o);
default:
} // namespace
extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper;
-extern Q_CORE_EXPORT const QMetaObject *qMetaObjectWidgetsHelper;
void qRegisterWidgetsVariant()
{
+ qRegisterMetaType<QWidget*>();
qMetaTypeWidgetsHelper = qVariantWidgetsHelper;
- qMetaObjectWidgetsHelper = &QWidget::staticMetaObject;
QVariantPrivate::registerHandler(QModulesPrivate::Widgets, &widgets_handler);
}
Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant)
template<> struct TestValueFactory<QMetaType::QObjectStar> {
static QObject * *create() { return new QObject *(0); }
};
-template<> struct TestValueFactory<QMetaType::QWidgetStar> {
- static QWidget * *create() { return new QWidget *(0); }
-};
template<> struct TestValueFactory<QMetaType::VoidStar> {
static void * *create() { return new void *(0); }
};
};
Q_STATIC_ASSERT(( QMetaTypeId2<QSizePolicy>::IsBuiltIn));
-Q_STATIC_ASSERT(( QMetaTypeId2<QWidget*>::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);
+ QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<QWidget*>()), &QWidget::staticMetaObject);
QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<QLabel*>()), &QLabel::staticMetaObject);
QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<CustomWidget*>()), &CustomWidget::staticMetaObject);
}
QCOMPARE(data.userType(), int(QMetaType::QObjectStar));
QVERIFY(data.canConvert<QWidget*>());
- QVERIFY(data.canConvert(QMetaType::QWidgetStar));
QVERIFY(data.canConvert(::qMetaTypeId<QWidget*>()));
QVERIFY(data.value<QWidget*>());
- QVERIFY(data.convert(QMetaType::QWidgetStar));
- QCOMPARE(data.userType(), int(QMetaType::QWidgetStar));
+ QVERIFY(data.convert(qMetaTypeId<QWidget*>()));
+ QCOMPARE(data.userType(), qMetaTypeId<QWidget*>());
} else {
QVERIFY(!data.canConvert<QObject*>());
QVERIFY(!data.canConvert(QMetaType::QObjectStar));
CustomQWidget customWidget;
QWidget *widget = &customWidget;
QVariant data = QVariant::fromValue(widget);
- QVERIFY(data.userType() == QMetaType::QWidgetStar);
+ QVERIFY(data.userType() == qMetaTypeId<QWidget*>());
QCOMPARE(data.value<QObject*>(), widget);
QCOMPARE(data.value<QWidget*>(), widget);