From d130c55be5fb7456465feb7fbd376d860b1e5ded Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Tue, 3 Nov 2026 13:31:02 +0100 Subject: [PATCH] Fix Qt6 resource compilation so LogView icons are embedded at runtime - QT5_ADD_RESOURCES was a no-op stub under Qt6, silently dropping .qrc files: LogView's :/image/* icons were never compiled into the binary. Map the stub onto qt6_add_resources() (outfiles-variable form, which appends the generated qrc_*.cpp to the source list). LogView is the only caller of the stub. - nglwidgets' Qt6 branch only processed rme_light_style.qrc; nglresources.qrc (which provides :icons/16x16/* toolbar/window icons) was left as a raw file in the source list and never compiled (CMAKE_AUTORCC is off). Process both qrcs. - LogView never loads libnglwidgets.so at runtime (--as-needed drops it: the code uses no nglwidgets symbols), so its :icons/16x16 resources were never registered for the app. Embed the 20 icons LogView actually uses directly into LogViewResources.qrc with explicit aliases (rcc rejects XML comments in .qrc and, without an alias, registers the full relative path as the resource name). --- .../TetraIF/LogView/LogViewResources.qrc | 22 +++++++++++++++++++ .../Z/src/nglwidgets/CMakeLists.txt | 10 +++++---- .../cmake/NGLMacros.cmake | 15 ++++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/qt6-after/qt6-migrated-legatus/TetraIF/LogView/LogViewResources.qrc b/qt6-after/qt6-migrated-legatus/TetraIF/LogView/LogViewResources.qrc index 4407b4f20..28d766803 100644 --- a/qt6-after/qt6-migrated-legatus/TetraIF/LogView/LogViewResources.qrc +++ b/qt6-after/qt6-migrated-legatus/TetraIF/LogView/LogViewResources.qrc @@ -15,4 +15,26 @@ image/ShowSend.png image/Wls.png + + ../../Z/src/nglwidgets/icons/16x16/configure.png + ../../Z/src/nglwidgets/icons/16x16/dialog-ok-apply.png + ../../Z/src/nglwidgets/icons/16x16/document-edit.png + ../../Z/src/nglwidgets/icons/16x16/document-import.png + ../../Z/src/nglwidgets/icons/16x16/document-new.png + ../../Z/src/nglwidgets/icons/16x16/document-open-data.png + ../../Z/src/nglwidgets/icons/16x16/document-save.png + ../../Z/src/nglwidgets/icons/16x16/edit-copy.png + ../../Z/src/nglwidgets/icons/16x16/edit-delete.png + ../../Z/src/nglwidgets/icons/16x16/edit-paste.png + ../../Z/src/nglwidgets/icons/16x16/edit-redo.png + ../../Z/src/nglwidgets/icons/16x16/go-down.png + ../../Z/src/nglwidgets/icons/16x16/go-up.png + ../../Z/src/nglwidgets/icons/16x16/list-add.png + ../../Z/src/nglwidgets/icons/16x16/list-remove.png + ../../Z/src/nglwidgets/icons/16x16/mail-send.png + ../../Z/src/nglwidgets/icons/16x16/media-play-normal.png + ../../Z/src/nglwidgets/icons/16x16/media-playback-start.png + ../../Z/src/nglwidgets/icons/16x16/media-playback-stop.png + ../../Z/src/nglwidgets/icons/16x16/rde_16x16.png + diff --git a/qt6-after/qt6-migrated-legatus/Z/src/nglwidgets/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Z/src/nglwidgets/CMakeLists.txt index f048bca8b..6fe823779 100755 --- a/qt6-after/qt6-migrated-legatus/Z/src/nglwidgets/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/Z/src/nglwidgets/CMakeLists.txt @@ -83,11 +83,13 @@ NGL_WRAP_UI(nglwidgets_SRCS ) # Collect big resource QRCs -set(oxygen_SRCS nglresources.qrc) +set(oxygen_SRCS) if(TARGET Qt6::Core) - # Use Qt6's CMake helper to generate resource sources so resources are available at runtime - qt_add_resources(RME_LIGHT_RCC rme_light_style.qrc) - list(APPEND oxygen_SRCS ${RME_LIGHT_RCC}) + # Use Qt6's CMake helper to generate resource sources so resources are available at runtime. + # Both qrcs MUST go through qt_add_resources: a raw .qrc left in the source list is not + # compiled (CMAKE_AUTORCC is off), so its resources would be missing at runtime + # (e.g. :icons/16x16/* toolbar/window icons used by LogView). + qt_add_resources(oxygen_SRCS nglresources.qrc rme_light_style.qrc) else() NGL_ADD_BIG_RESOURCES(oxygen_SRCS nglresources.qrc rme_light_style.qrc) endif() diff --git a/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake b/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake index c987b8143..ff2b65e23 100755 --- a/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake +++ b/qt6-after/qt6-migrated-legatus/cmake/NGLMacros.cmake @@ -38,11 +38,20 @@ if(POLICY CMP0177) cmake_policy(SET CMP0177 OLD) endif() -# Compatibility stubs for Qt5 CMake macros when Qt6 is used. -# These stubs allow configure to succeed; actual resource/ui generation should be addressed during source migration. +# Compatibility stubs for Qt5 CMake macros when Qt6 is used (UI/CPP wrapping +# still no-op; resource handling is implemented below). +# QT5_ADD_RESOURCES maps onto Qt6's qt6_add_resources() in the outfiles-variable +# form: the generated qrc_.cpp sources are appended to the given source +# list, so .qrc files are compiled into the targets that reference them +# (e.g. TetraIF/LogView). Without this the resources are silently dropped and +# ":/..." icons render empty at runtime. if(NOT COMMAND QT5_ADD_RESOURCES) macro(QT5_ADD_RESOURCES _out) - set(${_out} "" PARENT_SCOPE) + if(TARGET Qt6::Core) + qt6_add_resources(${_out} ${ARGN}) + else() + message(WARNING "QT5_ADD_RESOURCES stub: Qt6::Core not found, skipping resources: ${ARGN}") + endif() endmacro() endif() if(NOT COMMAND QT5_ADD_BIG_RESOURCES)