I'm pleased to announce that the migration of the QtWidgets module to LeanQt is complete. The new LeanQt modules are widgets, itemviews and graphics, which can be optionally added to the build.
All widgets (including item and graphics views) work on Linux, Windows and Mac. LeanQt and its examples have been successfully tested with different configurations on Windows x86 & x86_64, on macOS x86_64 and M1, and on Linux x86, ARMv7 (Raspi) and x86_64.
With this release the LeanQt GUI is feature complete, and also my original goals are met in that I can now build my Oberon+ IDE with LeanQt, and am no longer dependent on original Qt for almost any of my projects; as expected I can just recompile my projects with LeanQt without any modifications to the source code.
The number of lines of code is now close to one million SLOC; the uncompressed source tree requires ~55 MB, and the ZIP is 12.5 MB. As described in the last release notes the size of the source tree can be reduced by removing the subdirectories not required.
How to build
LeanQt with item and graphic views can be built easily. By default, the sample applications that match the selected options are also built. Proceed as follows.
- Create a new directory; let's call it new_build (the name doesn't matter).
- Download https://github.com/rochus-keller/BUSY/archive/refs/heads/master.zip and unpack it to the new_build directory; rename the new subdirectory to e.g. BUSY (the name doesn't matter, but must correspond to the following commands).
- Download https://github.com/rochus-keller/LeanQt/archive/refs/heads/master.zip and unpack it to the new_build directory; rename the new subdirectory to e.g. LeanQt (the name doesn't matter, but must correspond to the following commands).
- Open a command line in the BUSY subdirectory and type
cc *.c -O2 -lm -O2 -o lua
orcl /O2 /MD /Fe:lua.exe *.c
depending on whether you are on a Unix or Windows machine; wait a few seconds until the lua executable is built. - Now type
./lua build.lua ../LeanQt -P HAVE_ITEMVIEWS -P HAVE_GRAPHICS
(orlua build.lua ../LeanQt -P HAVE_ITEMVIEWS -P HAVE_GRAPHICS
on Windows); wait until the build finishes; you find the example executables in the BUSY/output subdirectory; if you don't need optimizations but a faster build add the-P HAVE_NOOPT
option to the command line.
Note that both -P HAVE_ITEMVIEWS
and -P HAVE_GRAPHICS
automatically enable HAVE_WIDGETS. If you only need the basic widgets (including the rich text widgets) just use the -P HAVE_WIDGETS
option. If you prefer a shared library version of LeanQt just add the -P HAVE_SHARED
option. All options are declared and described in the root BUSY file.
When you start e.g. the chart application (e.g. via typing output/chart
or by double clicking on the executable), you should see something like this:
Note that it's easy to put all LeanQt stuff into just one shared or static library, and even to statically link the application with LeanQt; the Oberon+ project demonstrates how to do this. Essentially you just have to add libqt to the deps (instead of libqtcore, libqtgui and libqtwidgets) and the qt_client_config to the configs (instead of core_client_config, gui_client_config and widgets_client_config).
How to generate a qmake project
If you don't want to directly build the libraries and executables using the BUSY tool (as demonstrated in the previous section), but instead want to use qmake and Qt Creator to build and/or debug an application, BUSY lets you generate a qmake project.
To do so, just add -G qmake
to the command in step 5 of the procedure in the previous section, so it e.g. looks like ./lua build.lua ../LeanQt -P HAVE_ITEMVIEWS -P HAVE_GRAPHICS -G qmake
. In the BUSY/outputs directory (or any directory you choose with the -B
option) there is now a Project.pro file with a lot of subdirectories with yet other .pro files:
Now e.g. open the Project.pro file in Qt Creator. There you first have to select a Qt kit in the "Configure Project" dialog; BUSY generates qmake files compatible with Qt 5, so select an appropriate kit with a toolchain compatible with your target (it should also work with Qt 6, but I haven't tried). Here is how the project looks in Qt Creator:
It looks and behaves like any other Qt Creator project, but it's not using the Qt version selected with the kit, but LeanQt.
Limitations
See the readme for what is not supported in LeanQt.
The "macintosh" style doesn't fully work yet; there are some display errors; but the "fusion" style works and is automatically enabled also on Macintosh; the "macintosh" style can still be manually enabled e.g. by addign -style macintosh
to the application command line. Personally I'm not much interested in the macintosh style, so if anyone else wants to try their luck with debugging, help is greatly appreciated.
❇️❇️❇️ Merry Christmas and happy coding! ❇️❇️❇️