Unsolved How to exchange data between qt and javascript?
-
Hello everyone, my question is as the title.
For example: how to transmit qimage object between qt and javascript?
Could anyone tell me the reason? Thanks in advance! -
@small_bird What exactly do you mean? Do you want exchange data between QML and C++? Or how are you using JavaScript?
-
@jsulm No ,not qml and C++. It's qt and javascript.
I try to use javascript to make 3d scene. -
@small_bird To me it's still unclear how you use JavaScript in your app.
-
@jsulm Do you know three.js? I try to use that engine.
-
@small_bird But how? You're using C++/Qt and JavaScript, right?
-
@jsulm yes
-
@jsulm So I need to transmit data between qt and javascript. How to do that? Through signal and slot mechanism.
-
@small_bird I have no idea as long as you do not tell us how you're using JavaScript in your C++ app!
-
@jsulm Actually, it is not c++. It is QML and javascript.
-
@small_bird Good to know. I already asked you whether you're using QML you said no...
If you're using QML without C++ then I'm wondering how you can use QImage as you asked before?
Take a look at http://doc.qt.io/qt-5/qtqml-javascript-topic.html -
@jsulm However, now, I want to exchange data between C++ and javascript.
-
@small_bird Then exchange it between C++ and QML (check Qt documentation for this) and from QML then to JavaScript.
Or do you want to remove QML completely? -
@jsulm yes I have done that. But how to exchange qimage from qml to javascript?
-
@small_bird I don't know I would say it depends on that JavaScript three.js framework. Check it's API and data types.
-
@jsulm No, the javascript's grammar is the same with three.js engine.
-
@small_bird What do you mean by "grammar" and "engine"? three.js is a 3D JavaScript framework/library, right? So you need to check its documentation if you want to use it.
-
Yes, that's it. I have checked that, but how to transmit qimage data between qml and js function as it is not a inner type?
-
@small_bird said in How to exchange data between qt and javascript?:
That's three.js engine is written by javascript.
Sure it is. That's not the point. It has an API, right? See its documentation: https://threejs.org/docs/index.html#manual/introduction/Creating-a-scene