How to interface QML and Java?

感情迁移 提交于 2021-02-07 20:54:10

问题


If QML is used for GUI and Java for developing API for a linux based device,How to interface QML with Java?


回答1:


One approach for cross platform integration is using web service. I would probably expose my Java code as a RESTful web service (See JAX-RS) and invoke it from QML using XMLHttpRequest.

It's also worth mentioning Java GUI library such as swing / JavaFX has cross platform capability, so it should still run on Linux (and whichever platform runs Java). You might not need to write QML at all




回答2:


Possible approaches I can think of are :

  1. Qt Jambi
  2. JNI

[ You have mentioned to tell something other than these ]

Other than this :

Use qml for UI and interface it with C++ using Qt-qml bindings. Then expose these C++ interfaces over some IPC common to both Java and C++ ( For eg. expose something on D-Bus using Qt-Dbus and then call these functionality using Java-DBus code )



来源:https://stackoverflow.com/questions/17185074/how-to-interface-qml-and-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!