PDA

View Full Version : Using kwm window caption bar color



OldJohnB
29th January 2006, 00:53
I am writing an application using Qt on a Linux box running KDE. To limit the use of custom colors in the application I have tried to stick to the palette color that are easily accessed using Qt functions e.g. setPaletteBackgroundColor() and QColorGroup etc. However, I can't seem to find anyway to access the color used in the kwm caption decoration.

I am running Fedora 4 and Qt3.3 KDE 3.5 that comes with it. I note that there is a KDE class KDecoration that is not included in my release but is there any other way that I can use the KDE theme colors in my application?

OldJohnB

yogeshm02
30th January 2006, 16:16
I think that you cannot check titlebar color with Qt, you'll have to use KDE libs for that. Maybe because Qt has nothing to do with kdm. Qt apps can be used with any standard window manager and hence providing a standard way for checking color is very difficult if not impossible.

Correct me if I am wrong.

OldJohnB
30th January 2006, 23:27
I am sure you are right in the sense that Qt will not be able to change the KDE color theme. However, I think Qt does use the colors used by whatever platform it is installed on since the widget background, foreground, highlight etc. colors are derived from the OS window colors? So why can't I get the window caption (title bar) color?

OldJohnB

yogeshm02
1st February 2006, 14:54
...I think Qt does use the colors used by whatever platform it is installed on ...

Then why Qt4 is not using colors from my current KDE configuration.
:confused:

wysota
4th February 2006, 13:26
Because KDE3 uses Qt3 and not Qt4, thus Qt4 apps don't have any knowledge of KDE3 (including the styles and decorations).

Xagen
4th February 2006, 15:51
I am writing an application using Qt on a Linux box running KDE. To limit the use of custom colors in the application I have tried to stick to the palette color that are easily accessed using Qt functions e.g. setPaletteBackgroundColor() and QColorGroup etc. However, I can't seem to find anyway to access the color used in the kwm caption decoration.

I am running Fedora 4 and Qt3.3 KDE 3.5 that comes with it. I note that there is a KDE class KDecoration that is not included in my release but is there any other way that I can use the KDE theme colors in my application?

OldJohnB

As I understand you want to use your kwin(kde's wm) colors. There are no problem: take a look at $HOME/.kde/share/config/kdeglobals (or another kde config). Find there the setting you need and use in your own app.

I used this method to create QIconThemeProvider (QT4). It's a class that automatically provides KDE's pixmaps for my application according to the KDE's settings, current icon theme and etc...

But be careful - you should make a check if there is kde installed on the computer!

If you want to know more - write to me:
demogorgorn AT gmail.com

OldJohnB
8th February 2006, 08:00
Thanks, looks like a promising approach but it would be nice if there was a ready made function for extracting the colors?

OldJohnB
9th February 2006, 05:00
Hi Xagen, Tried to reach you by email but messages were returned. I wrote:

Thanks for the suggestion. I've had a look in $HOME/.kde/share/config/kdeglobals and found the colors that look like my current kde color theme. My question now is how do I access these automatically from C++ code. Did you search the file and parse the appropriate line in kdeglobals or is there a function that does that for you?