Qt Jambi: Difference between revisions
No edit summary |
(I updated this fully outdated description of QtJambi to its current situation.) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | |||
''QtJambi'' is a community-maintained open-source project that provides Java language bindings to the Qt APIs. The bindings are generated by inspection of the C++ header files of the Qt implementation then emitting code to provide the necessary JNI (Java Native Interface) and ''.java'' files to provide linkage to Java. An application programmer using Qt Jambi would simply add the coresponding Java libraries (''.jar'' files) to their Java project to be able to develop and deploy their application. | |||
Example:<syntaxhighlight lang="java"> | |||
import io.qt.widgets.*; | |||
public class Test { | |||
public static void main(String[] args) { | |||
QApplication.initialize(args); | |||
QMessageBox.information(null, "QtJambi", "Hello World!"); | |||
QApplication.shutdown(); | |||
} | |||
} | |||
</syntaxhighlight>The bindings implement typical C++-Qt features for Java like: | |||
* signal/slot mechanism | |||
* meta object properties | |||
* thread-affinity, multithreading, cross-thread marshaling | |||
* resource management | |||
* internationalization | |||
* interfaces | |||
* containers | |||
* function pointers | |||
* QML / Java interoperability | |||
* and more | |||
Indeed the API presented to the Java programmer is very similar to the C++ APIs so your knowledge of C++ can largely be transferred to Java. These alternative programming models maybe considered a new and refreshing choice for application developers looking for an alternative to the strict static type programming patterns employed by other Java UI toolkits. Qt Jambi makes use of Java reflection and can integrate with the QMetaObject system (that provides similar reflection mechanism to C+)''.'' | |||
There is much overlap with some Qt modules with already existing Java APIs and 3rd party libraries. Qt Jambi does not inhibit or restrict the implementation of a feature you choose to use. However, the combination of Qt and other UI toolkits in the same application is technically limited. Some of the strengths of Qt to Java are in the cross-platform UI toolkit, the programming model, UI scripting support, embedded web browser support. | |||
Another feature of the project is that it is possible to reuse your custom C++ QWidget's and other QPlugins with Qt Jambi. If your objects expose QMetaObject they may simply work as the java bindings are able to invoke and integrate with QMetaObject. Alternatively you can use the generator (provided in the Qt Jambi project) to expose Java API bindings for your custom C++ library. This allows you to combine the benefit of C++ performance in areas where it is needed with the rapid application development enjoyed by Java developers. | |||
==Qt Jambi past== | |||
Before March 2009 the project ('qt-jambi') was maintained and released by Trolltech, their latest release was Qt Jambi 4.5.2_01 based on a port of Qt 4.5.2. This is last version by the Qt team (based at Trolltech). When Nokia purchased Trolltech the Qt Jambi project was not put into the future road map so the work was spun off into the open source project. The source code project that is called 'qt-jambi' is from this pre March 2009 era and does not support any version of Qt 4.7 or later. The successor open source project 'https://github.com/qtjambi/qtjambi<nowiki/>' continued support for all Qt versions between 4.5 and 4.8. | |||
==Binaries== | |||
[https://github.com/OmixVisualization/qtjambi/releases QtJambi Releases] | |||
==Repository== | |||
https://github.com/OmixVisualization/qtjambi ''this source tree is actively being developed'' | |||
==See also== | |||
== See also == | |||
This page describes the Java bindings. There is also QtScript which is the JavaScript bindings. Similar sounding technologies, but very different :) | This page describes the Java bindings. There is also QtScript which is the JavaScript bindings. Similar sounding technologies, but very different :) |
Latest revision as of 08:13, 10 May 2021
QtJambi is a community-maintained open-source project that provides Java language bindings to the Qt APIs. The bindings are generated by inspection of the C++ header files of the Qt implementation then emitting code to provide the necessary JNI (Java Native Interface) and .java files to provide linkage to Java. An application programmer using Qt Jambi would simply add the coresponding Java libraries (.jar files) to their Java project to be able to develop and deploy their application.
Example:
import io.qt.widgets.*;
public class Test {
public static void main(String[] args) {
QApplication.initialize(args);
QMessageBox.information(null, "QtJambi", "Hello World!");
QApplication.shutdown();
}
}
The bindings implement typical C++-Qt features for Java like:
- signal/slot mechanism
- meta object properties
- thread-affinity, multithreading, cross-thread marshaling
- resource management
- internationalization
- interfaces
- containers
- function pointers
- QML / Java interoperability
- and more
Indeed the API presented to the Java programmer is very similar to the C++ APIs so your knowledge of C++ can largely be transferred to Java. These alternative programming models maybe considered a new and refreshing choice for application developers looking for an alternative to the strict static type programming patterns employed by other Java UI toolkits. Qt Jambi makes use of Java reflection and can integrate with the QMetaObject system (that provides similar reflection mechanism to C+).
There is much overlap with some Qt modules with already existing Java APIs and 3rd party libraries. Qt Jambi does not inhibit or restrict the implementation of a feature you choose to use. However, the combination of Qt and other UI toolkits in the same application is technically limited. Some of the strengths of Qt to Java are in the cross-platform UI toolkit, the programming model, UI scripting support, embedded web browser support.
Another feature of the project is that it is possible to reuse your custom C++ QWidget's and other QPlugins with Qt Jambi. If your objects expose QMetaObject they may simply work as the java bindings are able to invoke and integrate with QMetaObject. Alternatively you can use the generator (provided in the Qt Jambi project) to expose Java API bindings for your custom C++ library. This allows you to combine the benefit of C++ performance in areas where it is needed with the rapid application development enjoyed by Java developers.
Qt Jambi past
Before March 2009 the project ('qt-jambi') was maintained and released by Trolltech, their latest release was Qt Jambi 4.5.2_01 based on a port of Qt 4.5.2. This is last version by the Qt team (based at Trolltech). When Nokia purchased Trolltech the Qt Jambi project was not put into the future road map so the work was spun off into the open source project. The source code project that is called 'qt-jambi' is from this pre March 2009 era and does not support any version of Qt 4.7 or later. The successor open source project 'https://github.com/qtjambi/qtjambi' continued support for all Qt versions between 4.5 and 4.8.
Binaries
Repository
https://github.com/OmixVisualization/qtjambi this source tree is actively being developed
See also
This page describes the Java bindings. There is also QtScript which is the JavaScript bindings. Similar sounding technologies, but very different :)