46 #include <QApplication> 53 static QScriptEngine* engine_;
55 QScriptValue
callFunction( QString _plugin, QString _functionName , std::vector< QScriptValue > _parameters ) {
58 Qt::ConnectionType connection = Qt::DirectConnection;
59 if (h.thread() != QApplication::instance()->thread())
61 h.moveToThread(QApplication::instance()->thread());
62 connection = Qt::BlockingQueuedConnection;
66 if (!QMetaType::type(
"std::vector<QScriptValue>"))
67 qRegisterMetaType< std::vector< QScriptValue > >(
"ScriptParameters");
70 QMetaObject::invokeMethod(&h,
"callFunction", connection ,
71 Q_RETURN_ARG(QScriptValue, retVal),
72 Q_ARG(QScriptEngine*, engine_),
73 Q_ARG(QString, _plugin),
74 Q_ARG(QString, _functionName),
75 Q_ARG(std::vector< QScriptValue >, _parameters));
81 QScriptValue
callFunction( QString _plugin, QString _functionName ) {
84 Qt::ConnectionType connection = Qt::DirectConnection;
85 if (h.thread() != QApplication::instance()->thread())
87 h.moveToThread(QApplication::instance()->thread());
88 connection = Qt::BlockingQueuedConnection;
94 QMetaObject::invokeMethod(&h,
"callFunction", connection ,
95 Q_RETURN_ARG(QScriptValue, retVal),
96 Q_ARG(QScriptEngine*, engine_),
97 Q_ARG(QString, _plugin),
98 Q_ARG(QString, _functionName));
QScriptValue callFunction(QString _plugin, QString _functionName, std::vector< QScriptValue > _parameters)
Call a function provided by a plugin getting multiple parameters.
void setScriptEngine(QScriptEngine *_engine)
DONT USE! (Function to set the internal reference to the script Engine)
QScriptEngine * getScriptEngine()
get a pointer to OpenFlippers core scripting engine