I have found zero documentation on this subject (Have I been searching in the wrong places? It seems strange to me).
I simply need to be able to use a Qt GUI for my Vala application. An example would be appreciated.
As others have mentioned, Qt and Vala don't work hand-in-hand, but that doesn't mean it's impossible to get them to cooperate. It's mostly about understanding what's going on beneath the covers.
Vala generates C code which is then fed to gcc (or another installed compiler) to produce a binary. Note that one of the Vala designers' chief goals was for Vala to produce C-based libraries. These can then be used by other languages that accept C-based bindings -- Python, Ruby, Java, and so on.
So, you could use Vala to code a C-based library that your Qt C++ GUI application calls into. The Vala compiler produces a .h file that your Qt app merely #includes.
The problem with this is that Qt and Vala use different object systems: QObject for Qt, GObject for Vala. (Vala does allow for other backends, and there's even some thought about Vala producing Qt C++ instead of GObject-based C, but that's far in the future.) QObject and GObject are not compatible, and so for your QObjects to talk with GObjects, you need to do a lot of manual C-based work. (Writing GObject in C is quite verbose, hence the allure of Vala to hide all of it.)
But it can be done. Note that Qt will even use GLib's event loop rather than its own, allowing for the code to commingle in an event-driven application.
I can't heartily recommend the above, but in theory it's possible, mostly because C++ code can easily call C code.
Another possibility worth considering is make Vala code a DBus server and your Qt code a DBus client. DBus is a fancy IPC, and so this is not suitable for all applications, but it might be for yours. It's attractive because Vala can easily produce DBus clients and servers (they look like ordinary objects). Tools to produce Qt DBus bindings are available as well. Note that this means your Vala code runs as a separate process and is not an in-process library. See http://live.gnome.org/Vala/DBusServerSample and http://live.gnome.org/Vala/DBusClientSamples
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With