54 #include <QApplication>
61 static QScriptEngine* engine_;
63 QScriptValue
callFunction( QString _plugin, QString _functionName , std::vector< QScriptValue > _parameters ) {
66 Qt::ConnectionType connection = Qt::DirectConnection;
67 if (h.thread() != QThread::currentThread())
69 h.moveToThread(QApplication::instance()->thread());
70 connection = Qt::QueuedConnection;
74 if (!QMetaType::type(
"std::vector<QScriptValue>"))
75 qRegisterMetaType< std::vector< QScriptValue > >(
"ScriptParameters");
78 QMetaObject::invokeMethod(&h,
"callFunction", connection ,
79 Q_RETURN_ARG(QScriptValue, retVal),
80 Q_ARG(QScriptEngine*, engine_),
81 Q_ARG(QString, _plugin),
82 Q_ARG(QString, _functionName),
83 Q_ARG(std::vector< QScriptValue >, _parameters));
89 QScriptValue
callFunction( QString _plugin, QString _functionName ) {
92 Qt::ConnectionType connection = Qt::DirectConnection;
93 if (h.thread() != QThread::currentThread())
95 h.moveToThread(QApplication::instance()->thread());
96 connection = Qt::QueuedConnection;
102 QMetaObject::invokeMethod(&h,
"callFunction", connection ,
103 Q_RETURN_ARG(QScriptValue, retVal),
104 Q_ARG(QScriptEngine*, engine_),
105 Q_ARG(QString, _plugin),
106 Q_ARG(QString, _functionName));
void setScriptEngine(QScriptEngine *_engine)
DONT USE! (Function to set the internal reference to the script Engine)
QScriptValue callFunction(QString _plugin, QString _functionName, std::vector< QScriptValue > _parameters)
Call a function provided by a plugin getting multiple parameters.
QScriptEngine * getScriptEngine()
get a pointer to OpenFlippers core scripting engine