diff options
Diffstat (limited to 'tools/qscxmlc')
-rw-r--r-- | tools/qscxmlc/decl.t | 2 | ||||
-rw-r--r-- | tools/qscxmlc/scxmlcppdumper.cpp | 20 | ||||
-rw-r--r-- | tools/qscxmlc/scxmlcppdumper.h | 6 |
3 files changed, 21 insertions, 7 deletions
diff --git a/tools/qscxmlc/decl.t b/tools/qscxmlc/decl.t index 482c123..baf1600 100644 --- a/tools/qscxmlc/decl.t +++ b/tools/qscxmlc/decl.t @@ -5,7 +5,7 @@ class ${classname}: public QScxmlStateMachine ${properties} public: - ${classname}(QObject *parent = 0); + Q_INVOKABLE ${classname}(QObject *parent = 0); ~${classname}(); ${accessors} diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp index d99b3b0..40ae1dd 100644 --- a/tools/qscxmlc/scxmlcppdumper.cpp +++ b/tools/qscxmlc/scxmlcppdumper.cpp @@ -374,8 +374,8 @@ int createFactoryId(QStringList &factories, const QString &className, const int idx = factories.size(); QString line = QStringLiteral("case %1: return new ").arg(QString::number(idx)); - if (invokeInfo.expr == QScxmlExecutableContent::NoInstruction) { - line += QStringLiteral("QScxmlStaticScxmlServiceFactory< %1::%2 >(") + if (invokeInfo.expr == QScxmlExecutableContent::NoEvaluator) { + line += QStringLiteral("QScxmlStaticScxmlServiceFactory(&%1::%2::staticMetaObject,") .arg(namespacePrefix, className); } else { line += QStringLiteral("QScxmlDynamicScxmlServiceFactory("); @@ -445,7 +445,7 @@ void CppDumper::dump(TranslationUnit *unit) const QVector<QScxmlExecutableContent::ParameterInfo> ¶meters, const QSharedPointer<DocumentModel::ScxmlDocument> &content) -> int { QString className; - if (invokeInfo.expr == QScxmlExecutableContent::NoInstruction) { + if (invokeInfo.expr == QScxmlExecutableContent::NoEvaluator) { className = mangleIdentifier(classnameForDocument.value(content.data())); } return createFactoryId(factories[i], className, namespacePrefix, @@ -755,6 +755,20 @@ QString CppDumper::generateMetaObject(const QString &className, classDef.qualified = classDef.classname; classDef.superclassList << qMakePair(QByteArray("QScxmlStateMachine"), FunctionDef::Public); classDef.hasQObject = true; + FunctionDef constructor; + constructor.name = className.toUtf8(); + constructor.access = FunctionDef::Public; + constructor.isInvokable = true; + constructor.isConstructor = true; + + ArgumentDef arg; + arg.type.name = "QObject *"; + arg.type.rawName = arg.type.name; + arg.normalizedType = arg.type.name; + arg.name = "parent"; + arg.typeNameForCast = arg.type.name + "*"; + constructor.arguments.append(arg); + classDef.constructorList.append(constructor); // stateNames: int stateIdx = 0; diff --git a/tools/qscxmlc/scxmlcppdumper.h b/tools/qscxmlc/scxmlcppdumper.h index 9c8cfe8..a987f80 100644 --- a/tools/qscxmlc/scxmlcppdumper.h +++ b/tools/qscxmlc/scxmlcppdumper.h @@ -26,8 +26,8 @@ ** ****************************************************************************/ -#ifndef CPPDUMPER_H -#define CPPDUMPER_H +#ifndef SCXMLCPPDUMPER_H +#define SCXMLCPPDUMPER_H #include "qscxmlglobals.h" @@ -99,4 +99,4 @@ private: QT_END_NAMESPACE -#endif // CPPDUMPER_H +#endif // SCXMLCPPDUMPER_H |