2024-07-12 –, If (1.1)
One of the options to build a GUI in Julia is the QML.jl package, which provides the tools to connect a Qt QML GUI to Julia code. The package has been around for some years, but in 2023 it was updated to use Qt 6 and a new, more flexible model was introduced for working with tables. This talk will focus on these enhancements. In addition, there will be some remarks on graphical GUI design tooling and future Makie.jl integration plans.
The Qt QML language allows users to describe graphical user interfaces using a declarative programming style, similar in style to a JSON file. A simple example for showing a rectangle is:
import QtQuick
import QtQuick.Controls
ApplicationWindow {
Rectangle {
width: 100; height: 100; color: "red"
Text {
anchors.centerIn: parent
text: "Hello!"
}
}
}
The QML.jl package offers the infrastructure to launch the GUI from within Julia, and link Julia functions and values to elements of the GUI. This makes it possible to e.g. execute a Julia function when clicking a button, or show the output of a plot command in the GUI.
Since the previous presentation of QML.jl at JuliaCon 2020 Qt has been upgraded to version 6, and QML.jl now supports this. Aside from overall improvements in quality and performance, this change also enables full compatibility with Wayland on Linux and the matching of the native platform desktop style has improved, so applications can take on a Windows or macOS look automatically on the respective platform. Qt 6 also introduces a new way of using tabular data, which prompted the development of the new JuliaItemModel
type, which makes it easier than ever to present and modify tabular data in any of the standard QML elements that take a table or list of items. One possible application for this is to make an interactive DataFrame
editor, for example.
The objective of this talk is to illustrate these new features, based on a simple demo application for working with tables, which we will first design in a GUI design tool. Even though QML is an easy language to read and write, many people prefer to design GUIs visually, so we will show that this workflow is also possible for QML.jl, using the standard tools provided by Qt. Once the GUI design is complete, we will show how to link it to Julia code and data.
Finally, we will end with some remarks on future work, such as more elaborate and up-to-date support for Makie.jl. Indeed, QML.jl already supports overlaying both regular OpenGL content and Makie.jl scenes with QML elements, but the idea is to split off this functionality into a separate package, so it becomes easier to use and keeps up better with the latest Makie version.
Resources
Bart Janssens is a military associate professor at the mechanics department of the Royal Military Academy, with a passion for computer graphics, high performance computing and fluid mechanics.