diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-06-25 12:47:57 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-06-25 12:52:55 (GMT) |
commit | c938ec01a76bf56f667481e626fbb9252ee3d05d (patch) | |
tree | 063a742b510a71b1ed1ee6b3fc41a9288fe23273 /src/corelib/kernel/qmetaobject.cpp | |
parent | 2d9aaff174d70953ed1f98c24baaf0c9abac78aa (diff) | |
download | Qt-c938ec01a76bf56f667481e626fbb9252ee3d05d.zip Qt-c938ec01a76bf56f667481e626fbb9252ee3d05d.tar.gz Qt-c938ec01a76bf56f667481e626fbb9252ee3d05d.tar.bz2 |
make invokable constructors work with classes in namespace
Use the fully qualified classname at relevant places in the
moc-generated code. Also, QMetaObject::newInstance() needs to
strip the namespace part, since the constructor signatures
don't contain the fully qualified name.
Task-number: 246064
Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 2d57e0b..71dd5ff 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -218,8 +218,14 @@ QObject *QMetaObject::newInstance(QGenericArgument val0, QGenericArgument val8, QGenericArgument val9) const { + QByteArray constructorName = className(); + { + int idx = constructorName.lastIndexOf(':'); + if (idx != -1) + constructorName.remove(0, idx+1); // remove qualified part + } QVarLengthArray<char, 512> sig; - sig.append(className(), qstrlen(className())); + sig.append(constructorName.constData(), constructorName.length()); sig.append('('); enum { MaximumParamCount = 10 }; |