PDA

View Full Version : How to call a Qt function from Java swing



tatung
9th April 2012, 13:09
Hi,

I now have a Qt project (qtmm - https://github.com/tatung/qtmm). This project is a working Qt application.

Now I need to use some functions of this project in Java. I mean calling a Qt function from Java swing application. Does anyone know how to do it :)

Or, is there any way to export Qt project to a library and use that library in Java.

I've found QtJambi but it seems to be used for GUI only. (not really sure about this)

Please help, Thanks

PS: the Qt app qtmm above has a function of reading AudioInput and process it, return a string. The function will emit a signal when new string available. I wonder if is there any way to read this string from Java swing. Maybe something like a BlockingQueue as sink for Qt app putting new string in that, and Java app take that string.

qlands
10th April 2012, 22:01
Hi,

You can use JNI to JNA. See this posts

http://stackoverflow.com/questions/1210115/how-to-call-c-functionality-from-java

Be aware that qtmm might generate a library that you can use with JNI so you might need to fork that project and create a library from it that would be usable with JNI or JNA.

Hope this help.