Merge branch 'master' into 1.4

This commit is contained in:
Arin Alexander 2016-07-25 16:05:54 +03:00
commit 224c1da1c6

View File

@ -208,6 +208,18 @@ QScriptValue line(QScriptContext* pcontext, QScriptEngine* pengine){
return res;
}
QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){
QString name = pcontext->argument(0).toString();
QVariant value = pcontext->argument(1).toVariant();
ScriptEngineManager* sm = qscriptvalue_cast<ScriptEngineManager*>(pcontext->callee().data());
DataSourceManager* dm = sm->dataManager();
dm->changeVariable(name,value);
return QScriptValue();
}
QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){
QVariant value = pcontext->argument(0).toVariant();
char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f';
@ -400,8 +412,9 @@ ScriptEngineManager::ScriptEngineManager()
addFunction("dateTimeFormat", dateTimeFormat, "DATE&TIME", "dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
addFunction("date",date,"DATE&TIME","date()");
addFunction("now",now,"DATE&TIME","now()");
addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+",\""+tr("Locale")+"\")");
addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")");
addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")");
addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")");
QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor);
m_scriptEngine->globalObject().setProperty("QColor", colorCtor);