diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index 1a95d7265f..4f762b5e96 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -558,7 +558,7 @@ QMetaMethodBuilder QMetaObjectBuilder::addConstructor(const QMetaMethod &prototy QMetaPropertyBuilder QMetaObjectBuilder::addProperty(const QByteArray &name, const QByteArray &type, int notifierId) { - return addProperty(name, type, QMetaType::fromName(name), notifierId); + return addProperty(name, type, QMetaType::fromName(type), notifierId); } /*! diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index d8b7a96f4c..188a5a6626 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -1638,17 +1638,19 @@ void tst_QMetaObjectBuilder::classNameFirstInStringData() } struct MyFoo {}; +struct myParameter {}; void tst_QMetaObjectBuilder::propertyMetaType() { + qRegisterMetaType(); QMetaType meta = QMetaType::fromType(); auto metaId = meta.id(); QMetaObjectBuilder builder; builder.setClassName("Test"); - builder.addProperty("test", "MyFoo"); + builder.addProperty("myParameter", "MyFoo"); auto mo = builder.toMetaObject(); - QMetaProperty metaProp = mo->property(mo->indexOfProperty("test")); + QMetaProperty metaProp = mo->property(mo->indexOfProperty("myParameter")); QCOMPARE(metaProp.typeName(), meta.name()); QCOMPARE(metaProp.typeId(), metaId); QCOMPARE(metaProp.metaType(), meta);