KIconLoader
Lynn Hazan
lynn.hazan at lsce.ipsl.fr
Fri Jan 8 08:40:42 GMT 2010
I received the answer concerning the application icon, so I post it:
kde4_add_app_icon(myapp_SRCS <list of png's>)
replace myapp_SRCS with whatever the sources are listed in, and the list of
png's can be absolute paths or relative paths. here's an example:
http://websvn.kde.org/*checkout*/trunk/KDE/kdebase/workspace/plasma/desktop/shell/CMakeLists.txt
Lynn
>Thanks a lot for your help, it worked.
>I have 2 complementary questions:
>Does it work the same way for cursors?
> =>Do I have to use the same macro "kde4_install_icons(
>${ICON_INSTALL_DIR} ) even if it is cursor?
>=> what about the image naming?
>How do I do for my application Icon?
>Lynn
Le Thursday 07 January 2010 22:39:15, vous avez écrit :
> On January 7, 2010, Lynn Hazan wrote:
> > If anyone can help me on the following topic I will really appreciate as
> > I have been fighting with for days.
> >
> > I just want to specify my own icons and cursors. I did it without any
> > problem using KDE3 but with KDE4 I can not manage to do it. The only
> > thing I can get is the unknow icon (
> > /usr/lib/kde4/share/icons/oxygen/16x16/mimetypes/unknown.png).
> > I am sure it is pretty easy to do when you know how.
> >
> > Here is what I did :
> >
> > * create an icons directory in my source directory
>
> put a CMakeLists.txt file in this directory with just "kde4_install_icons(
> ${ICON_INSTALL_DIR} )" in it and then put add_subdirectory(icons) in the
> top level CMakeLists.txt
>
> > * add an icon (zoom_tool.png) in this directory
>
> should be something like ox32-action-zoom_tool.png which means "put this in
> the actions directory, it's an oxygen icon, size of 32 pixels". adjust as
> appropriate :)
>
> > * try to upload the icon in my code:
> > KIconLoader *loader = KIconLoader::global();
> > KAction* selectAction = new KAction(this);
> > selectAction->setIcon(KIcon(loader->loadIcon("zoom_tool",
> > KIconLoader::NoGroup)));
>
> you should be able to just do KIcon("zoom_tool")
-------------------------------------------------------
More information about the kde-core-devel
mailing list