forked from qt-creator/qt-creator
Added method defaultValueForBuiltinType(typeName) to the QML/JS interpreter.
This commit is contained in:
@@ -1680,6 +1680,19 @@ const ObjectValue *Engine::qmlKeysObject()
|
||||
return _qmlKeysObject;
|
||||
}
|
||||
|
||||
const Value *Engine::defaultValueForBuiltinType(const QString &typeName) const
|
||||
{
|
||||
if (typeName == QLatin1String("string") || typeName == QLatin1String("url"))
|
||||
return stringValue();
|
||||
else if (typeName == QLatin1String("bool"))
|
||||
return booleanValue();
|
||||
else if (typeName == QLatin1String("int") || typeName == QLatin1String("real"))
|
||||
return numberValue();
|
||||
// ### more types...
|
||||
|
||||
return undefinedValue();
|
||||
}
|
||||
|
||||
ObjectValue *Engine::newQmlObject(const QString &name)
|
||||
{
|
||||
#ifndef NO_DECLARATIVE_BACKEND
|
||||
|
||||
@@ -442,6 +442,7 @@ public:
|
||||
// QML objects
|
||||
ObjectValue *newQmlObject(const QString &name);
|
||||
const ObjectValue *qmlKeysObject();
|
||||
const Value *defaultValueForBuiltinType(const QString &typeName) const;
|
||||
|
||||
// global object
|
||||
ObjectValue *globalObject() const;
|
||||
|
||||
Reference in New Issue
Block a user