This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/native/native_bridge.cpp
2019-12-21 21:55:53 +08:00

24 lines
978 B
C++

#include "context_manager.h"
#include "native_bridge.h"
#include "plugin/shader_plugin.h"
Q_INVOKABLE void NativeBridge::function(int contextId, QString module, QString methodName, QString callbackId, QJSValue jsValue) {
qDebug() << "contextId: " + QString::number(contextId) + ", " +
"module: " + module + ", " +
"methodName: " + methodName + ", " +
"callbackId: " + callbackId + ", " +
"arguments: " + jsValue.toString();
Context *context = ContextManager::getInstance()->getContext(contextId);
QString value = context->driver->getRegistry()->acquirePluginInfo(module);
qDebug() << value;
if (value.contains("ShaderPlugin")) {
ShaderPlugin shaderPlugin(context);
QMetaObject::invokeMethod(
&shaderPlugin,
methodName.toStdString().c_str(),
Qt::AutoConnection,
Q_ARG(QJSValue, jsValue));
}
}