Reply to topic

How can my app get informed that the colorscheme changed?

Petross404 (petross)
Registered Member
Posts
7
Karma
0
I want to connect a lamda function to a signal that gets emmited when the colorscheme (either global or app-specific) is changed.

Now I am using
Code: Select all
...
        auto c = client().data();
...
        connect(c, static_cast<void (KDecoration2::DecoratedClient::*)(const QPalette&)>(&KDecoration2::DecoratedClient::paletteChanged), this,
                [this]
        {
            this->paintTitleBar(&painter, repaintRegion);
        });

but it's qt breeze-specific and it isn't using the Frameworks API. I would like it to be able to support gtk applications too. I found ColorScope, is this right?
kde-cfeck
Registered Member
Posts
58
Karma
0
You want http://doc.qt.io/qt-5/qguiapplication.h ... tteChanged

KDecorations2 is just for window decorations.
Petross404 (petross)
Registered Member
Posts
7
Karma
0
kde-cfeck wrote:You want http://doc.qt.io/qt-5/qguiapplication.h ... tteChanged

KDecorations2 is just for window decorations.


So there isn't a way to handle this in a more generic way? Like read gtk palette too and force a repaint if this palette changes?
airdrik
Registered Member
Posts
1698
Karma
4
OS
I'm pretty sure gtk3 does something completely different, since their themes are derived more directly from (svg) images and css.

Regardless, I believe Qt should take care of translating whatever it is that gtk may be doing (when using the gtk theme for qt), so insofar as qt is able to recognize that the gtk color palette has changed then it will update its colors and fire off that event.


airdrik, proud to be a member of KDE forums since 2008-Dec.
Petross404 (petross)
Registered Member
Posts
7
Karma
0
airdrik wrote:I'm pretty sure gtk3 does something completely different, since their themes are derived more directly from (svg) images and css.

Regardless, I believe Qt should take care of translating whatever it is that gtk may be doing (when using the gtk theme for qt), so insofar as qt is able to recognize that the gtk color palette has changed then it will update its colors and fire off that event.


Thank you very much for your kind help. ;) I will look more into this.
jamesrenick
Registered Member
Posts
1
Karma
0
A similar code also uses sites like this one

 
Reply to topic

Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, DarkFoss1, franzhall, Google [Bot], philhopkins, Snudl, Yahoo [Bot]