diff options
author | Liang Qi <liang.qi@qt.io> | 2017-01-25 10:21:11 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-01-25 10:21:11 +0100 |
commit | 5d851f27a3c72e46df0dfdd234fc3a300a2870fb (patch) | |
tree | 4fa416bfe19dd0de544a1babc649ecd66d814346 /tools | |
parent | 4b4e81398bdfcda23a9e3c86a297e12b2ff1e9d9 (diff) | |
parent | c575eb524bc26fc4af3711d634110c226c9e11c0 (diff) |
Merge remote-tracking branch 'origin/5.8' into devv5.9.0-alpha1
Conflicts:
.qmake.conf
Change-Id: I639eb3acef7004a20447bbb66fb44661bf8e952e
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qscxmlc/decl.t | 2 | ||||
-rw-r--r-- | tools/qscxmlc/scxmlcppdumper.cpp | 20 | ||||
-rw-r--r-- | tools/qscxmlc/scxmlcppdumper.h | 6 | ||||
-rw-r--r-- | tools/tools.pro | 2 |
4 files changed, 21 insertions, 9 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 diff --git a/tools/tools.pro b/tools/tools.pro index f96987d..1854cfc 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -1,4 +1,2 @@ TEMPLATE = subdirs SUBDIRS = qscxmlc - -qscxmlc.CONFIG = host_build |