Commit 104fec38 authored by Jan Möbius's avatar Jan Möbius
Browse files

Create DataTaype in scripting through Strings ( TypeName->TypeId )

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8514 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 487415a3
...@@ -76,8 +76,18 @@ QScriptValue createDataType(QScriptContext *context, QScriptEngine *engine) ...@@ -76,8 +76,18 @@ QScriptValue createDataType(QScriptContext *context, QScriptEngine *engine)
// If arguments are given, use them for initialization otherwise // If arguments are given, use them for initialization otherwise
// initialize with 0 // initialize with 0
if (context->argumentCount() == 1) { if (context->argumentCount() == 1) {
s = context->argument(0).toNumber(); QVariant argument = context->argument(0).toVariant();
bool ok;
// Try if we can convert a given uint here
s = argument.toUInt(&ok);
// If not, we get a String and should therefore try to resolve it via the Typename
if (! ok )
s = typeId(argument.toString());
} else { } else {
// Basic construction without an Argument! Set to Unknown
s = DATA_UNKNOWN; s = DATA_UNKNOWN;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment