[Kde-games-devel] Kde logo for using in about menu

Josef Spillner kde-games-devel@mail.kde.org
Thu, 13 Feb 2003 13:09:35 +0100


Hi,

On Wednesday 12 February 2003 19:45, Albert Astals Cid wrote:
> How do i show the KDE logo in my menu?
>
> I'm doing this
>
> QPixmap *kde pixmap= new QPixmap("/usr/share/icons/kde.xpm");
>
> KPopupMenu *pm help = new KPopupMenu(this);
>
> pm help -> insertItem(*icon(), i18n("&About KTic-Tac-Toe"), this,
> SLOT(about()));
>
> pm help -> insertItem(*kde pixmap, i18n("About &KDE"), this,
> SLOT(about kde()));

Why not simply create the QPixmap on the stack_
QPixmap kde_pixmap("...");

> But i don't think every distribution has kde.xpm in that path.

This is why KStandardDirs has been invented for.
#include <kstandarddirs.h>
KStandardDirs d;
QPixmap kde_pixmap(d.findResource("icon", "crystalsvg/16x16/apps/kmenu.png"));

Note that this has 2 limitations: Icon theme, and icon size. Both can be 
avoided when using methods such as SmallIcon("about_kde") (using 
KIconLoader).

> Is there a better way of doing it?

- insert the standard help menu using helpMenu() into the menuBar()
- even better: use KXMLGUI

Josef

-- 
Free operating systems. Free software. Free games.