Web lists-archives.com

Qml/Plasma icon coloring issue




Hi all,

We are currently porting parts of the Kdenlive UI to Qml, and I have one issue with the Breeze icons when used in a Qml scene embedded in a QQuickWidget.

We enforce a color theme in our app using:

qApp->setPalette(palette());
QGuiApplication::setPalette(plt);

When used in QWidgets, everything works fine and the icon color automatically adjust to the theme, using the text color. However, icons used in Qml do not adjust their color WHEN the system icon theme is different than Breeze. I tried several options, described below but was unable to get the expected behavior: breeze icon following the application color theme. Did anyone encounter this problem ? is it a limitation of the icon coloring feature ? Any idea how I could solve the problem ?

What I tried:

Forcing the app icons using QIcon::setTheme('breeze') or the icontheme.rcc file in $appdata gave the same results:

1 - Using plain Qml, ToolButton {iconName:'arrow-down'}: the icon remains black no matter what color theme is used for the application

2 - Using PlasmaCore.IconItem : The icon changes color when changing the global desktop color theme, but not when changing the application color theme with setPalette()

3 -  Using QIconItem, sameresults as QML's ToolButton icon

As I said, this behavior only happens if the Desktop icon theme is different than Breeze. If you use Breeze as icon theme, everything works fine.

Any help appreciated, thanks.


Jean-Baptiste Mardelle