mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 09:04:39 +03:00
Merge branch 'master' into 1.4
This commit is contained in:
commit
224c1da1c6
@ -208,6 +208,18 @@ QScriptValue line(QScriptContext* pcontext, QScriptEngine* pengine){
|
|||||||
return res;
|
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){
|
QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){
|
||||||
QVariant value = pcontext->argument(0).toVariant();
|
QVariant value = pcontext->argument(0).toVariant();
|
||||||
char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f';
|
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("dateTimeFormat", dateTimeFormat, "DATE&TIME", "dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
|
||||||
addFunction("date",date,"DATE&TIME","date()");
|
addFunction("date",date,"DATE&TIME","date()");
|
||||||
addFunction("now",now,"DATE&TIME","now()");
|
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("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")");
|
||||||
|
addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")");
|
||||||
|
|
||||||
QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor);
|
QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor);
|
||||||
m_scriptEngine->globalObject().setProperty("QColor", colorCtor);
|
m_scriptEngine->globalObject().setProperty("QColor", colorCtor);
|
||||||
|
Loading…
Reference in New Issue
Block a user