Skip to content

rcalixte/libqt6zig-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libqt6zig-examples

MIT License Static Badge


Example applications using the MIT-licensed Qt 6 bindings for Zig

These examples can be thought of as instructive templates for using the main library. Though some of the examples have some complexity to them, the intention is to aim for simplicity while demonstrating valid uses of the library. All of source code for the examples are a single file by design. Any auxiliary files are placed in the same directory for either compilation or execution purposes. Please try out the sample applications and start a discussion if you have any questions or issues relevant to these examples.


TABLE OF CONTENTS

License

The sample applications within libqt6zig-examples are licensed under the MIT license.

Building

The dependencies for building the sample applications are the same as the main library. Refer to the main library's Building section for more information.

It is recommended to execute an initial build to generate a clean build cache before making any changes. This allows the build process to use the cached build artifacts to speed up subsequent builds.

Once the required packages are installed, the library can be built from the root of the repository:

zig build

Users of Arch-based distributions need to make sure that all packages are up-to-date first and will need to add the following option to support successful compilation:

zig build -Denable-workaround=true

To skip the restricted extras:

zig build -Dskip-restricted=true

Example applications can also be built and run independently:

zig build helloworld events

Applications can be installed to the system in a non-default location by adding the --prefix-exe-dir option to the build command:

sudo zig build --prefix-exe-dir /usr/local/bin # creates /usr/local/bin/{examples}

To see the full list of examples available:

zig build -l

To see the full list of examples and build options available:

zig build --help

The source code for the examples can be found in the src directory of the repository.

FAQ

Q1. How long does it take to compile the examples?

The examples compile the main library and then build the sample applications from the source code. The first compilation should take less than 10 minutes, assuming the hardware in use is at or above the level of that of a consumer-grade mid-tier machine released in the past decade. Once the build cache is warmed up for the examples, subsequent compilations should be very fast, on the order of seconds.

Q2. What build modes are supported by the examples?

Currently, only ReleaseFast, ReleaseSafe, and ReleaseSmall are supported. The Debug build mode is not supported. This may change in the future. The default build mode is ReleaseFast. To change the build mode:

zig build -Doptimize=ReleaseSafe

Q3. Are translations supported?

Several options are available to implement translations ranging from functions available in the main library to well-supported systems such as GNU gettext to Qt's internationalization options. Developers are free to use any of the available options or implement their own solution.

Q4. Do the applications built with this library support theming?

debian_cinnamon_helloworld endeavour_kde_helloworld
Debian + Cinnamon + Qt 6.7 (custom theme) EndeavourOS + KDE + Qt 6.8
fedora_kde_helloworld freebsd_xfce_helloworld
Fedora + KDE + Qt 6.8 FreeBSD + Xfce + Qt 6.8
mint_cinnamon_helloworld ubuntu_helloworld
Linux Mint + Cinnamon + Qt 6.4 Ubuntu + Qt 6.4

Special Thanks

  • @mappu for the MIQT bindings that provided the phenomenal foundation for this project

  • @arnetheduck for proving the value of collaboration on the back-end of the library while working across different target languages