[PyKDE] menu icons

Ricardo Javier Cardenes Medina rcardenes at debian.org
Thu Dec 5 01:38:00 GMT 2002

On Thu, Dec 05, 2002 at 09:58:23AM +1100, Richard Jones wrote:
> > > In kde3, I've noticed that there are some 'standard' icons used
> > > in the menus for things like '&Quit'.
> > > Is there a pre-made QIconSet or QPixmap to grab, or do I need to
> > > find the file and load from it?
> >
> > On a SuSE system, they're most likely under /opt/kde3/share/icons/.
> > I'd expect a fairly similar location (except rooted somewhere other
> > than /opt perhaps) for other distributions.
> Don't the icons change according to the user's selected icon set? How do we 
> hook into that?

Within KDE, they use code like this (I got it from KDirAdm):

  // little helper borrowed from the KMail Sources: - thanks guys ;)
  static inline QPixmap loadIcon( const char * name )
    return KGlobal::instance()->iconLoader()->loadIcon(
          QString::fromLatin1(name), KIcon::NoGroup, KIcon::SizeMedium);

So you use a generic name (eg: loadIcon("personal.png");), and the icon
loader selects the right one from the current configured icon theme.

More information about the PyQt mailing list