PDA

View Full Version : How to get notified about changes in global color scheme



Shark
14th March 2018, 15:03
Hi
I have a class which stores some QColors based on the desktop's colour scheme. I would like to get the colours updated as soon as the user changes the colour scheme. How can I do this?
The program is for KDE, so maybe a KDE-specific solution would be fine, too.

d_stranz
14th March 2018, 16:39
In Windows, there is a WM_SYSCOLORCHANGE (https://msdn.microsoft.com/en-us/library/windows/desktop/dd145223(v=vs.85).aspx) message that gets sent to all top-level windows. If there is a similar mechanism in KDE (I don't know), you should be able to intercept these by reimplementing QCoreApplication::winEventFilter() in a derived class.