[kdecore Index] [kdecore Hierarchy] [Headers]
KIconLoader is a derived class from QObject More...
#include <kiconloader.h>
Inherits: QObject (qt)
KIconLoader is a derived class from QObject.
It supports loading of icons from disk. It puts the icon and its name
into a QList and if you call loadIcon() for a second time, the icon is taken
out of the list and not reread from disk.
So you can call loadIcon() as many times as you wish and you don't have
to take care about multiple copies of the icon in memory.
[public]
config is the pointer to a KConfig object; normally the global KConfig object. group is the name of a group in a config file. key is the name of an entry within this group.
Normaly group == "KDE Setup" and key == "IconPath" Example for an entry in .kderc: [KDE Setup] IconPath=/usr/local/lib/kde/lib/pics:/usr/local/lib/kde/lib/pics/toolbar
This gives KIconLoader the path to search the icons in.
If you want to use another path in your application then write into your .my_application_rc: [MyApplication] PixmapPath=/..../my_pixmap_path and call KIconLoader( config, "MyApplication", "PixmapPath" ).
[public]
There now exists a simple-to-use version of KIconLoader. If you create a KIconLoader without giving arguments, KIconLoader searches for the path in [KDE Setup]:IconPath=... as a default.
[public]
Destructor
[public]
This function searches for the icon called name and returns a QPixmap object of this icon if it was found and 0 otherwise. If name starts with "/..." loadIcon treats it as an absolut pathname. LoadIcon() creates a list of all loaded icons, so calling loadIcon() a second time with the same name argument won't load the icon again, but gets it out of its cache. By this you don't have to worry about multiple copies of one and the same icon in memory, and you can call loadIcon() as often as you like.
If the icon is larger then the specified size, it is scaled down automatically. If the specified size is 0, the icon is not scaled at all.
[public]
Same like loadIcon, except that cached icons will be reloaded. This is useful if the icon has changed on the filesystem and you want to be sure that you get the new version, not the old one from the cache.
[public]
Same like loadIcon, but looks for "mini/name" first.
[public]
This functions inserts a new directory into the searchpath at position index. It returns TRUE if successful, or FALSE if index is out of range. Note that the default searchpath looks like this:
1: $HOME/.kde/share/apps/
5: $HOME/.kde/share/icons 6: $HOME/.kde/share/toolbar
7: $KDEDIR/share/icons 8: $KDEDIR/share/toolbar
9-x: list of directories in [KDE Setup]:IconPath=...
[public]
Set always_valid to true if you want this function to return a valid pixmap is your wishes cannot be satisfied (Be aware, that if unknown.xpm is not found you will receive a null string)
[public]
Remove an icon from the cache given it's name
Documentation generated by tasin@cd1 on Die Nov 30 17:31:35 CET 1999 | Kdoc |