[PyKDE] KDE default application icon

Jim Bublitz jbublitz at nwinternet.com
Mon Sep 25 06:04:20 BST 2006


On Sunday 24 September 2006 03:15, Alek Wojdyga wrote:
> Hello everyone,
>   how can I get the KDE default application icon?
> So far I've looked in .desktop file for Icon=.... line and searched for
> icon using findfile in some hardcoded dirs.
> Can this be achieved in a easier and more flexible (not hardcoded dirs)
> way?

I'm not sure what you're asking here. You can set the icon like this (assuming 
'mainWindow' is the main window of your app, and a KMainWindow descendant):

icons = KIconLoader ()
mainWindow.setIcon (QPixmap (icons.loadIcon("stop", KIcon.Desktop)))

where "stop" is a icon's name ("stop" is the red circle with a white X in it).

Or (if your KApplication object is 'app'), you can get the QPixmap for the 
icon by doing:

iconPixmap = app.icon ()

iconPixmap will be a QPixmap corresponding to the icon.

Is there something different you want to do?

Jim




More information about the PyQt mailing list