[Interest] How to get icon theme?

Sérgio Martins sergio.martins at kdab.com
Thu Apr 23 21:36:36 CEST 2020


On 2020-04-21 19:57, Matthew Woehlke wrote:
> How do I determine what icon theme my application is using?
> QIcon::themeName() just returns an empty string. (But
> QIcon::fallbackThemeName() says "breeze"!) I am actually using
> "breeze-dark", and if I don't do anything, I get icons from that
> theme.


I don't think there's public API regarding theme.
For setting, there's QT_QPA_PLATFORMTHEME and -platformtheme argument.

For icon theme name, there's 
QPlatformTheme::themeHint(QPlatformTheme::SystemIconThemeName), but 
already private API, an seems it's returning empty for you.

When it comes to theme, I usually use the source, start from 
https://code.woboq.org/qt5/qtbase/src/gui/image/qiconloader.cpp.html#_ZN11QIconLoader17ensureInitializedEv
dig your way to an answer


Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Expertsc


More information about the Interest mailing list