diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-12 02:35:28 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-12 02:35:28 (GMT) |
commit | b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be (patch) | |
tree | b9c4adba9bf64a3f8f62d1b1299f5083f3896ea2 /src/declarative/qml | |
parent | 4889729b32b30a4bad90a0add8ca444529dea2e7 (diff) | |
parent | f2219ce983098fc14655d8f3bb8a7fee2c9abe4d (diff) | |
download | Qt-b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be.zip Qt-b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be.tar.gz Qt-b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Allow enum values to be used as signal parameters
ListModel::clear() should not clear roles
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativeboundsignal.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 28dfea9..47a15cb 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -225,9 +225,35 @@ QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(const QMeta QMetaPropertyBuilder prop = mob.addProperty(name, "QObject*"); prop.setWritable(false); } else { + QByteArray propType = type; + if (t >= QVariant::UserType || t == QVariant::Invalid) { + //copy of QDeclarativeObjectScriptClass::enumType() + QByteArray scope; + QByteArray name; + int scopeIdx = propType.lastIndexOf("::"); + if (scopeIdx != -1) { + scope = propType.left(scopeIdx); + name = propType.mid(scopeIdx + 2); + } else { + name = propType; + } + const QMetaObject *meta; + if (scope == "Qt") + meta = &QObject::staticQtMetaObject; + else + meta = parent->parent()->metaObject(); //### assumes parent->parent() + for (int i = meta->enumeratorCount() - 1; i >= 0; --i) { + QMetaEnum m = meta->enumerator(i); + if ((m.name() == name) && (scope.isEmpty() || (m.scope() == scope))) { + t = QVariant::Int; + propType = "int"; + break; + } + } + } if (QDeclarativeMetaType::canCopy(t)) { types[ii] = t; - QMetaPropertyBuilder prop = mob.addProperty(name, type); + QMetaPropertyBuilder prop = mob.addProperty(name, propType); prop.setWritable(false); } else { types[ii] = 0x80000000 | t; |