theming questions

Dirk Hohndel dirk at hohndel.org
Fri Dec 25 23:19:55 GMT 2020


After spending some quality time with the documentation I could find (not a lot) and with the sample plugin that I was able to find (Noah’s qqc2-breeze-plugin) I’m not sure if I understand more or am more confused. :-)

I was able to build the plugin (that requires a lot of KF5 infrastructure, but for figuring out how this all is supposed to work I’m not too worried about that) and load the plugin, but then what do I do with it? Or asked differently, what do I get from having it?

Looking through the sources I can see that this would allow me to create templates for every graphical element - but when I played with that idea, I don’t think I was able to actually see the effect of it.

To test, I create a minimal app that created a QPluginLoader that then created an instance for that plugin (making sure that the loading of the .so was successful). And then created a Kirigami.ApplicationWindow with a Label inside. 
Now I modified Noah’s plugin to make the label text yellow.
Rebuilt, made sure the new one was loaded, ran my app... label isn’t yellow.

So I’m clearly missing “something”.

And also, I understood that somehow I can use that to set the desired colors in the Kirigami.Theme and that I couldn’t figure out at all. I can see the Theme.qml in the plugin, but not a C++ class that would allow me to set / propagate color changes.

So it’s possible I’m looking at the completely wrong plugin, or that I’m missing the obvious in how to use this plugin to do the thing I want to do :-)

I’d appreciate a few more pointers how to get from A to B.

(my guess is that most of you are away from your keyboards, enjoying the holidays... I should be doing the same, I guess :^] )

/D

> On Dec 23, 2020, at 15:00, Dirk Hohndel <dirk at hohndel.org> wrote:
> 
> Hi Nicholas,
> 
> Thanks for the response - you are aiming just outside of my level of 'full understanding' how all of this is supposed to work together :-)
> 
> 
>> On Dec 23, 2020, at 12:34 PM, Nicolas Fella <nicolas.fella at gmx.de> wrote:
>> The Kirigami.Theme that we have in QML is backed by the PlatformTheme class
>> (https://invent.kde.org/frameworks/kirigami/-/blob/master/src/libkirigami/platformtheme.cpp).
>> It contains a plugin system that is responsible for loading the actual colors
>> (https://invent.kde.org/frameworks/kirigami/-/blob/master/src/libkirigami/platformtheme.cpp#L916)
>> and a fallback implementation
>> (https://invent.kde.org/frameworks/kirigami/-/blob/master/src/libkirigami/basictheme.cpp).
> 
> Cool - that's a good place for me to start reading and understanding how this all fits together. So far it's been all "git grep" and trying to find something that I understand and that does what I want :-)
> 
>> The plugin is selected based on the QQC2 style, for example the
>> implementation for qqc2-desktop style can be found at
>> https://invent.kde.org/frameworks/qqc2-desktop-style/-/blob/master/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp.
>> My suggestion would be to create your own color plugin and ship that
>> with your app. That would allow you to define the various
>> Kirigami.Theme.* values based on your own logic while not requiring any
>> special QML code.
> 
> That definitely sounds like the right way to go.
> 
>> What QQC2 style do you use in your app? If you have
>> your own anyway then it would be a matter of having a plugin with the
>> right name in the plugin path and it would be selected. If not then we
>> can talk about adding some API that allows selecting a specific color
>> plugin.
> 
> I don't think we do (I know, terrible answer, showing that I'm not fully understanding the toolkit that I use for my app.
> The main target platforms for the app are Android and iOS - but you can run 'mobile on desktop' both on Linux and Mac.
> My guess is that QQC2 has a different style for each of these platforms.
> 
> I'll do some reading based on all the new information that you provided and see what I can figure out.
> 
> And of course -- always grateful for more pointers :-)
> 
> Thanks and happy holidays!
> 
> /D


More information about the Plasma-devel mailing list