250.6. qt5ct-1.9
Qt 5 appearance settings — the palette, style, fonts and icon theme of every Qt 5 program, as a platform theme plugin
| Version | 1.9, release 4 |
| Shelf | themes — Icon, cursor, sound and widget themes, and theme-configuration tools |
| Phase | 43_toolkits (Toolkits), 325 of 344 in build order |
| Licence | BSD-2-Clause |
| Homepage | https://sourceforge.net/projects/qt5ct/ |
| Build time | 0.1 SBU |
| Installed size | 1.1 MiB in 23 files |
| Recipe | ports/core/themes/qt5ct/kpkgbuild |
About
qt5ct is the appearance configuration of Qt 5 programs: a Qt platform theme plugin that applies a palette, widget style, fonts and icon theme from ~/.config/qt5ct/qt5ct.conf. KDE’s platform theme is built for Qt 6 only, so every Qt 5 program on KDOS (VLC, KeePassXC, LMMS, Mumble and the rest) draws through this one. A person with no qt5ct.conf of their own gets a copy of /usr/share/kdos/xdg/qt5ct/qt5ct.conf, the bone accent, the first time a Qt 5 program starts, and kdos theme merges each accent’s palette into it from then on.
Why it is in KDOS
The comment above the 4 ports from qt5ct to plasma-workspace-wallpapers in script/phases/43_toolkits/packages.d/themes.txt:
qt5ct hands the Qt 5 applications the desktop's palette; Qt 6 applications take it from Plasma's own platform theme. kdos-plasma-look depends on it for the palettes it installs, so it is not a leaf.
Sources
qt5ct-1.9.tar.bz2(85.4 KiB)
sha256dc10e6939d423b925981ce67febb1a015b6f61c022a9cc7e6c8b5efea4588bff
upstream: https://downloads.sourceforge.net/project/qt5ct/qt5ct-1.9.tar.bz2
archive copy: sources-4/themes--qt5ct-1.9.tar.bz2
Dependencies
Depends on: cmake, ninja, qt5-qtbase, qt5-qttools, qt5-qtsvg, qt5-qtwayland, breeze-icons, librsvg.
Required by (1): kdos-plasma-look.
Patches
build.sh applies these; kpkg applies nothing by itself.
kde-key.patch— Makes the plugin answer the platform theme namekdeas well asqt5ctandqt6ct:Qt5CTPlatformThemePlugin::create()insrc/qt5ct-qtplugin/main.cppaccepts the key, andqt5ct.jsonlists it. The session exportsQT_QPA_PLATFORMTHEME=kde, which loads KDE’s platform theme in a Qt 6 program; KDE’s platform theme is built for Qt 6 only, and each Qt major version searches only its own plugin directory, so with the patch a Qt 5 program loads qt5ct under the same value and the Qt 6 plugin is untouched.portal-reentry.patch— Load the dialog theme once when it loads this plugin againxdgdesktopportal builds its base theme from the desktop's theme names, and under KDE that name is the key this plugin answers, so its readSettings() would create another portal theme without end and overflow the stack.
portal-reentry.patch makes readSettings() in src/qt5ct-qtplugin/qt5ctplatformtheme.cpp load the dialog theme named by standard_dialogs only in the outermost copy of the plugin, behind a static bool loadingDialogs. KDOS’s qt5ct.conf names xdgdesktopportal, so a Qt 5 program’s Open and Save dialogs are the file-chooser portal’s, which is KDE’s dialog. Qt’s portal theme builds its own base theme from the desktop’s theme names, and under XDG_CURRENT_DESKTOP=KDE the first of them is kde, which is qt5ct itself under kde-key.patch: without the guard each qt5ct it loads loads another portal theme, until the stack overflows and the program dies at start. The patch is to be offered upstream.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/43_toolkits/phase.env && kpkg install qt5ct'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/themes/qt5ct.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/themes/qt5ct
echo 'dc10e6939d423b925981ce67febb1a015b6f61c022a9cc7e6c8b5efea4588bff qt5ct-1.9.tar.bz2' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/qt5ct
SRC=$SRC_ROOT/qt5ct-1.9
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf qt5ct-1.9.tar.bz2 -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/kde-key.patch"
patch -p1 -i "$PORT_SRC/portal-reentry.patch"
cmake -B build -G Ninja -Wno-dev \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DDISABLE_DBUS=OFF
ninja -C build
DESTDIR=$PKG ninja -C build install
for _size in 32 48 64 128; do
install -d "$PKG/usr/share/icons/hicolor/${_size}x${_size}/apps"
rsvg-convert -w "$_size" -h "$_size" \
-o "$PKG/usr/share/icons/hicolor/${_size}x${_size}/apps/qt5ct.png" \
/usr/share/icons/breeze/preferences/32/preferences-desktop-theme.svg
done
cat > "$PKG/usr/share/applications/qt5ct.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Qt 5 Settings
GenericName=Qt 5 Appearance
Comment=Palette, style, fonts and icons of Qt 5 programs
Exec=qt5ct
Icon=qt5ct
Terminal=false
NoDisplay=true
StartupWMClass=qt5ct
Categories=Settings;DesktopSettings;Qt;
Keywords=settings;desktop;qt;qt5;theme;style;palette;font;icons;
DESKTOP
chmod 644 "$PKG/usr/share/applications/qt5ct.desktop"
The switches, and why each is set:
-DDISABLE_DBUS=OFF— keep D-Bus support, which upstream describes as the global menu and the D-Bus tray icon implementation; it links Qt 5’s D-Bus and theme-support modules into the plugin. This is upstream’s default, named so it stays on.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/qt5ct, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf qt5ct-1.9-4.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/qt5ct, and runs the triggers its paths call for.
Contents
Installed programs: qt5ct.
Installed libraries: libqt5ct-common.so.
Installed directories: /usr/lib/qt5/plugins/styles, /usr/share/licenses/qt5ct, /usr/share/qt5ct/qss.
Notes
Upstream’s desktop entry names the theme icon preferences-desktop-theme and no StartupWMClass. The recipe rasterises Breeze’s 32-pixel preferences-desktop-theme.svg, read from the installed breeze-icons in the build root, into 32, 48, 64 and 128-pixel hicolor PNGs named qt5ct, and overwrites upstream’s qt5ct.desktop with its own entry, which names that icon. qt5ct sets its desktop file name to qt5ct.desktop, so its Wayland app id is qt5ct, which the entry names in StartupWMClass.
The interface translations are compiled into the program by lrelease from qt5-qttools, and the configure reads Qt 5’s plugin directory from the qtpaths beside it; it stops when it cannot find either.
The entry is NoDisplay=true: the settings window edits a file kdos theme rewrites on every accent change, so offering it in the menu offers a change that does not last. qt5ct stays installed and runs by name; Kickoff, KRunner’s application search and Discover do not offer it.