[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmymoney-devel
Subject:    Re: Question about commit
From:       Pino Toscano <pino () kde ! org>
Date:       2018-02-12 7:09:37
Message-ID: 3171802.4SM516MIgU () pendragon
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,

In data sabato 10 febbraio 2018 21:18:19 CET, Thomas Baumgart ha scritto:
> this commit on the 5.0 branch
> 
> commit 9b27c432ef80c9d4a35bc9dff37619cde9673343
> Author: Pino Toscano <pino@kde.org>
> Date:   Thu Feb 8 22:16:47 2018 +0100
> 
>     cmake: install local icons in the local datadir
>     
>     Install all the local actions icons to the kmymoney data directory, to
>     avoid polluting the global icon themes.
>     
>     Fixes commit d9cf5550c478d95d4faf312c1149f30829829516.
> 
> apparently causes that the icons are not shown anymore in the application. Any 
> idea of what to look for?

I see, the icon loading code uses QIcon, which does not know about
local paths for icons. Can you please try the attached patch, which
switches to KIconLoader?

Since kmymoney has a lot of own icons, I'd really avoid to install them
in the global icon themes, with the risk of clashes with the themes
themselves. Also, the above commit makes the situation as it was in
kmymoney 4.x.

Thanks,
-- 
Pino Toscano
["kmm_icons.diff" (kmm_icons.diff)]

diff --git a/kmymoney/icons/CMakeLists.txt b/kmymoney/icons/CMakeLists.txt
index 099a740c..a0c41c40 100644
--- a/kmymoney/icons/CMakeLists.txt
+++ b/kmymoney/icons/CMakeLists.txt
@@ -33,7 +33,7 @@ set (icons_SOURCES
 
 add_library(kmm_icons SHARED ${icons_SOURCES})
 generate_export_header(kmm_icons)
-target_link_libraries(kmm_icons PRIVATE Qt5::Core Qt5::Gui)
+target_link_libraries(kmm_icons PRIVATE Qt5::Core Qt5::Gui KF5::IconThemes)
 
 set_target_properties(kmm_icons PROPERTIES
   VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
diff --git a/kmymoney/icons/icons.cpp b/kmymoney/icons/icons.cpp
index e0e79c92..0e681ffb 100644
--- a/kmymoney/icons/icons.cpp
+++ b/kmymoney/icons/icons.cpp
@@ -23,6 +23,8 @@
 #include <QPixmapCache>
 #include <QPainter>
 
+#include <KIconLoader>
+
 namespace Icons {
   QHash<Icon, QString> sStandardIcons;
 
@@ -347,7 +349,7 @@ namespace Icons {
 
     // try to retrieve the main icon from cache
     if (!QPixmapCache::find(iconName, pxIcon)) {
-      pxIcon = QIcon::fromTheme(iconName).pixmap(size);
+      pxIcon = KDE::icon(iconName).pixmap(size);
       QPixmapCache::insert(iconName, pxIcon);
     }
 
@@ -355,7 +357,7 @@ namespace Icons {
       return pxIcon;
 
     QPainter pixmapPainter(&pxIcon);
-    QPixmap pxOverlay = QIcon::fromTheme(overlayName).pixmap(size);
+    QPixmap pxOverlay = KDE::icon(overlayName).pixmap(size);
 
     int x, y;
     switch (corner) {
@@ -390,6 +392,6 @@ namespace Icons {
     if (sComposedIcons.contains(icon))
       return overlayIcon(sComposedIcons[icon]);
 
-    return QIcon::fromTheme(sStandardIcons[icon]);
+    return KDE::icon(sStandardIcons[icon]);
   }
 }

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic