A Qt application running as a Flatpak cannot directly access the Flatpak’s internal build version (like the commit hash or build date) at runtime through a standard API or environment variable. Flatpak itself primarily uses the application’s AppStream metadata for version display, not an internal, exposed build ID.
To have the build version available within your Qt application, you need to pass this information during the build process, typically using an environment variable.
Steps to Expose Build Version in a Qt Flatpak App
Define the version during the build: In your application’s build process (e.g., using flatpak-builder and a manifest file), you need to inject the version information. This is often done by passing a version string or commit hash to your build system (CMake, qmake, etc.).
Pass as an environment variable (optional but useful): You can set an environment variable within the Flatpak manifest that your application can read at runtime.
In the flatpak-builder manifest, you can add command-line-args or env variables that your application can access.
Read the environment variable in Qt: Your Qt application can use qEnvironmentVariable or QProcessEnvironment::systemEnvironment() to read the custom environment variable.
Now we need to find out who is building the Flatpak and pass this info to them.
I just realized, based a post of yours in another topic and looking again at Pneumarian’s post near the top of this thread, that the Linux build in Seamly2D’s github repository is an AppImage.
Both AppImages and Flatpaks are better options for programs like Seamly2D. I believe either can be used across all linux distributions. The different Linux “families” use different packaging systems to build natively for them; .deb, .rpm, and .aur may be the three most common. Each could have a different set of dependencies.
I think elsewhere I compared Flatpaks to PortableApps in Windows. That comparison is valid for AppImage builds more so than Flatpaks. I go with Flatpaks because I can update them form either the command line or from Linux Mint’s Software Manager.
To update an AppImage I would manually remove the previous file and then add the file for the new version. I stand corrected, by myself and Brave search. AppImages can be updated within the program if it is enabled by the builder. I would guess this is being done by the Seamly team.
Yes, AppImages can be updated within the program, but only if the developer has specifically included an update mechanism.
Some AppImages include a built-in “Update” option in their menu (e.g., under Help or Settings), which triggers an update process. This is typically done by bundling AppImageUpdate inside the AppImage itself, allowing the application to check for and apply updates directly.
To enable this:
The developer must embed update information (like a zsync URL) into the AppImage using appimagetool -u.
The AppImage must include the AppImageUpdate binary or use libappimageupdate to handle updates internally.
Important notes:
Not all AppImages support in-app updates—only those configured by the developer.
The update process is safe: the original file remains unchanged until the new version is verified, ensuring the app stays functional during the update.
For AppImages without built-in update support, users must manually download the new version or use external tools like AppImageUpdate.
In short, in-app updates are possible and recommended, but they are optional and depend entirely on the application author’s implementation.
I already know who’s (in part?) working on it. Hopefully I can discuss some of the issues with him during our weekly meeting next week.
Yes… the updater in Seamly2D handles the Windows, Mac & AppImage buillt on Github, as the CI always build all 3 any time a job is run. Maybe I’ll play with the updater with the Appimage this weekend… I need to check the Qt6.8 build w/dark mode on Linux. I have Ubuntu Mint on a USB stick, but I also have the latest Kubuntu to test the Dark mode with KDE, where there is apparently a bug with KDE that prevents the use of the Qt6.8 stylehints to set the theme. I’m trying to manualy set the style & palette to work around that issue.