mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-26 03:44:14 +02:00
8ef130a59d
QET had no icon theme: the 446 entries of the icon table and the 116 iconsets in .ui files each named a resource path, so an icon could only ever be one file, and a variant for another palette or a vector source had nowhere to go (GitHub #466, #690, #870). This adds the theme layout without changing a single pixel; a dark variant comes in a follow-up. The theme "qet" follows the freedesktop layout Qt's icon loader understands. misc/make_icon_themes.py generates ico/icon-themes.qrc, which aliases the existing ico/<size>/<name>.png files into themes/qet/<size>/<name>.png, and ico/themes/qet/index.theme. No file moves. The four table entries that paired a 16 pixel file with a 22 pixel file of another name (ConductorSettings, DiagramAdd, DiagramDelete, DialogInformation) get the 22 pixel file aliased under the 16 pixel name. QETApp::initIconTheme() registers the theme before initIcons() and makes it current on every platform, so a desktop icon theme cannot replace QET's icons. Icons are then looked up by name: QIcon::fromTheme() in qeticons.cpp and in the few places that built a QIcon from a resource path directly, and theme="..." on the iconsets in .ui files, with the resource path kept as fallback. Flags, color swatches, application and MIME icons stay on their paths. One entry does not go through the theme. The elements panel draws the project root with ProjectFileGP in the 50 pixel slot it reserves for element previews, and the name "project" also carries the 128 pixel file the configuration dialog uses. On a 2x display Qt's loader picks that file for a 50 pixel request and fills the slot. ProjectFileGP loads the 16 and 22 pixel files directly, as before. tests/qttest/tst_qeticons: every name in the theme resolves, the four aliases resolve at 22 pixels, a Fusion tool button shows its icon at 3:1 with disabled weaker than enabled, and the project root icon stays at 22 pixels or less when asked for 50 at 2x while the configuration dialog still gets its 128 pixel file. The rendering helpers shared with tst_qetpalette moved to tests/qttest/inkcontrast.h.