Bug 491274

Summary: Monochrome icons are not colored correctly in task manager with mixed themes
Product: [Frameworks and Libraries] frameworks-kirigami Reporter: Nicolas Fella <nicolas.fella>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: me, nate, notmart, qydwhotmail
Priority: NOR    
Version: Master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=491854
Latest Commit: Version Fixed In: 6.6
Sentry Crash Report:
Attachments: Screenshot

Description Nicolas Fella 2024-08-04 19:07:27 UTC
Created attachment 172278 [details]
Screenshot

STEPS TO REPRODUCE
1. Use dark Plasma and light applications theme 
2. Open any app that has a monochrome/symbolic app icon, e.g. the DrKonqi Crashed Processes viewer
3. Look at the task manager

OBSERVED RESULT
The icon elements are dark. See screenshot

EXPECTED RESULT
The icon elements are light

SOFTWARE/OS VERSIONS
KDE Plasma Version: master
KDE Frameworks Version: master
Qt Version: 6.8
Comment 1 Nicolas Fella 2024-08-04 19:11:37 UTC
The cause:
- libtaskmanager resolves the icon for the app and loads it via QIcon::fromTheme
- the UI passes that QIcon to Kirigami.Icon
- the libplasma kirigami plugin usually makes sure that icons are loaded with the right colors, but it doesn't apply here because we don't pass a name to Kirigami.Icon but a QIcon directly
Comment 2 Bug Janitor Service 2024-08-04 19:15:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1603
Comment 3 Nicolas Fella 2024-08-14 15:27:55 UTC
Git commit f673694e6f90efa0179a6f8322d4c44d544ff591 by Nicolas Fella.
Committed on 14/08/2024 at 12:43.
Pushed by nicolasfella into branch 'master'.

[icon] Fix icon colors when using Plasma platformtheme and QIcon source

When using a name as source we load the icon from the platform theme and
therefore apply the right theme colors.

However when we receive a QIcon as source it might not have been loaded
with the right theme colors.

To fix this check if the icon was obtained by name and reload it from the
platformtheme then. The late PlasmaCore.IconItem did something similar.

M  +20   -6    src/primitives/icon.cpp
M  +1    -0    src/primitives/icon.h

https://invent.kde.org/frameworks/kirigami/-/commit/f673694e6f90efa0179a6f8322d4c44d544ff591