diff --git a/kmymoney/icons/CMakeLists.txt b/kmymoney/icons/CMakeLists.txt --- a/kmymoney/icons/CMakeLists.txt +++ b/kmymoney/icons/CMakeLists.txt @@ -1,7 +1,5 @@ include(ECMInstallIcons) -add_definitions(-DKMYMONEY_ICON_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/kmymoney/icons") - file(GLOB_RECURSE KMYMONEY_HICOLOR_ICONS "hicolor/*") ecm_install_icons( ICONS ${KMYMONEY_HICOLOR_ICONS} diff --git a/kmymoney/icons/icons.cpp b/kmymoney/icons/icons.cpp --- a/kmymoney/icons/icons.cpp +++ b/kmymoney/icons/icons.cpp @@ -396,15 +396,6 @@ KMM_ICONS_EXPORT QIcon get(Icon icon) { -#ifdef KMYMONEY_ICON_DIR - static bool first_time = true; - if (first_time) { - first_time = false; - QStringList paths = QIcon::themeSearchPaths(); - paths.append(QStringLiteral(KMYMONEY_ICON_DIR)); - QIcon::setThemeSearchPaths(paths); - } -#endif if (sComposedIcons.contains(icon)) return overlayIcon(sComposedIcons[icon]); diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp --- a/kmymoney/kmymoney.cpp +++ b/kmymoney/kmymoney.cpp @@ -1163,6 +1163,23 @@ layout->setSpacing(6); { + // find where our custom icons were installed based on an custom icon that we know should exist after installation + const auto customIconRelativePath = QString(QStringLiteral("icons/hicolor/16x16/actions/account-add.png")); + auto customIconAbsolutePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, customIconRelativePath); + + // add our custom icons path to icons search path + if (!customIconAbsolutePath.isEmpty()) { + customIconAbsolutePath.chop(customIconRelativePath.length()); + customIconAbsolutePath.append(QLatin1String("icons")); + auto paths = QIcon::themeSearchPaths(); + paths.append(customIconAbsolutePath); + QIcon::setThemeSearchPaths(paths); + } else { + qWarning("Custom icons were not found in any of the following QStandardPaths::AppDataLocation:"); + for (const auto &standardPath : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) + qWarning() << standardPath; + } + #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) QString themeName = QLatin1Literal("system"); // using QIcon::setThemeName on Craft build system causes icons to disappear #else