# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KIconTheme Class Reference

Class to use/access icon themes in KDE. More...

`#include <kicontheme.h>`

Collaboration diagram for KIconTheme:

[legend]
List of all members.

## Public Member Functions

| KIconTheme (const QString &name, const QString &appName=QString::null)
QString | name () const
QString | description () const
QString | example () const
QString | screenshot () const
QString | linkOverlay () const
QString | zipOverlay () const
QString | lockOverlay () const
QString | shareOverlay () const
QString | dir () const
QStringList | inherits () const
bool | isValid () const
bool | isHidden () const
int | depth () const
int | defaultSize (KIcon::Group group) const
QValueList< int > | querySizes (KIcon::Group group) const
QStringList | queryIcons (int size, KIcon::Context context=KIcon::Any) const
QStringList | queryIconsByContext (int size, KIcon::Context context=KIcon::Any) const
KIcon | iconPath (const QString &name, int size, KIcon::MatchType match) const

## Static Public Member Functions

static QStringList | list ()
static QString | current ()
static void | reconfigure ()
static QString | defaultThemeName ()

## Detailed Description

Class to use/access icon themes in KDE.

This class is used by the iconloader but can be used by others too.

See also:
  KIconLoader

Definition at line 179 of file kicontheme.h.

## Constructor & Destructor Documentation

KIconTheme::KIconTheme | ( | const QString & | name,
|  | const QString & | appName = `QString::null`
| ) |

Load an icon theme by name.

Parameters:

  | name | the name of the theme (e.g. "hicolor" or "keramik")
  | appName | the name of the application. Can be null. This argument allows applications to have themed application icons.

Definition at line 82 of file kicontheme.cpp.

References QPtrList::append(), QValueList::begin(), QMap::contains(), dir(), KGlobal::dirs(), QValueList::end(), QFile::exists(), KStandardDirs::exists(), QPtrList::first(), QString::isEmpty(), name(), QPtrList::next(), KSharedConfig::openConfig(), KConfigBase::readBoolEntry(), KConfigBase::readEntry(), KConfigBase::readIntListEntry(), KConfigBase::readListEntry(), KConfigBase::readNumEntry(), KConfigBase::readPathEntry(), KConfigBase::readPathListEntry(), KStandardDirs::resourceDirs(), QPtrList::setAutoDelete(), and KConfigBase::setGroup().

## Member Function Documentation

QString KIconTheme::name | ( |  | ) | const`[inline]`

The stylized name of the icon theme.

Returns:
  the (human-readable) name of the theme

Definition at line 195 of file kicontheme.h.

Referenced by iconPath(), and KIconTheme().

QString KIconTheme::description | ( |  | ) | const`[inline]`

A description for the icon theme.

Returns:
  a human-readable description of the theme, QString::null if there is none

Definition at line 202 of file kicontheme.h.

QString KIconTheme::example | ( |  | ) | const

Return the name of the "example" icon.

This can be used to present the theme to the user.

Returns:
  the name of the example icon, QString::null if there is none

Definition at line 233 of file kicontheme.cpp.

QString KIconTheme::screenshot | ( |  | ) | const

Return the name of the screenshot.

Returns:
  the name of the screenshot, QString::null if there is none

Definition at line 234 of file kicontheme.cpp.

QString KIconTheme::linkOverlay | ( |  | ) | const

Returns the name of this theme's link overlay.

Returns:
  the name of the link overlay

Definition at line 235 of file kicontheme.cpp.

Referenced by KIconLoader::loadIcon().

QString KIconTheme::zipOverlay | ( |  | ) | const

Returns the name of this theme's zip overlay.

Returns:
  the name of the zip overlay

Definition at line 237 of file kicontheme.cpp.

Referenced by KIconLoader::loadIcon().

QString KIconTheme::lockOverlay | ( |  | ) | const

Returns the name of this theme's lock overlay.

Returns:
  the name of the lock overlay

Definition at line 236 of file kicontheme.cpp.

Referenced by KIconLoader::loadIcon().

QString KIconTheme::shareOverlay | ( |  | ) | const

Returns the name of this theme's share overlay.

Returns:
  the name of the share overlay

Since:
  3.1

Definition at line 238 of file kicontheme.cpp.

Referenced by KIconLoader::loadIcon().

QString KIconTheme::dir | ( |  | ) | const`[inline]`

Returns the toplevel theme directory.

Returns:
  the directory of the theme

Definition at line 246 of file kicontheme.h.

Referenced by iconPath(), KIconTheme(), list(), queryIcons(), and queryIconsByContext().

QStringList KIconTheme::inherits | ( |  | ) | const`[inline]`

The themes this icon theme falls back on.

Returns:
  a list of icon themes that are used as fall-backs

Definition at line 252 of file kicontheme.h.

bool KIconTheme::isValid | ( |  | ) | const

The icon theme exists?

Returns:
  true if the icon theme is valid

Definition at line 223 of file kicontheme.cpp.

References QPtrList::isEmpty().

Referenced by list().

bool KIconTheme::isHidden | ( |  | ) | const

The icon theme should be hidden to the user?

Returns:
  true if the icon theme is hidden

Since:
  3.1

Definition at line 228 of file kicontheme.cpp.

int KIconTheme::depth | ( |  | ) | const`[inline]`

The minimum display depth required for this theme.

This can either be 8 or 32.

Returns:
  the minimum bpp (8 or 32)

Definition at line 272 of file kicontheme.h.

int KIconTheme::defaultSize | ( | KIcon::Group | group | ) | const

The default size of this theme for a certain icon group.

Parameters:

  | group | The icon group. See KIcon::Group.

Returns:
  The default size in pixels for the given icon group.

Definition at line 240 of file kicontheme.cpp.

QValueList< int > KIconTheme::querySizes | ( | KIcon::Group | group | ) | const

Query available sizes for a group.

Parameters:

  | group | The icon group. See KIcon::Group.

Returns:
  a list of available sized for the given group

Definition at line 250 of file kicontheme.cpp.

QStringList KIconTheme::queryIcons | ( | int | size,
|  | KIcon::Context | context = `KIcon::Any`
| ) | const

Query available icons for a size and context.

Parameters:

  | size | the size of the icons
  | context | the context of the icons

Returns:
  the list of icon names

Definition at line 261 of file kicontheme.cpp.

References QPtrListIterator::current(), dir(), and QPtrListIterator::toFirst().

QStringList KIconTheme::queryIconsByContext | ( | int | size,
|  | KIcon::Context | context = `KIcon::Any`
| ) | const

Query available icons for a context and preferred size.

Parameters:

  | size | the size of the icons
  | context | the context of the icons

Returns:
  the list of icon names

Definition at line 314 of file kicontheme.cpp.

References QPtrListIterator::current(), and dir().

KIcon KIconTheme::iconPath | ( | const QString & | name,
|  | int | size,
|  | KIcon::MatchType | match
| ) | const

Lookup an icon in the theme.

Parameters:

  | name | The name of the icon, without extension.
  | size | The desired size of the icon.
  | match | The matching mode. KIcon::MatchExact returns an icon only if matches exactly. KIcon::MatchBest returns the best matching icon.

Returns:
  A KIcon class that describes the icon. If an icon is found,

See also:
  KIcon::isValid will return true, and false otherwise.

Definition at line 343 of file kicontheme.cpp.

References KIcon::context, QPtrListIterator::current(), dir(), QString::isEmpty(), name(), KIcon::path, KIcon::size, KIcon::threshold, and KIcon::type.

QStringList KIconTheme::list | ( |  | ) | `[static]`

List all icon themes installed on the system, global and local.

Returns:
  the list of all icon themes

Definition at line 448 of file kicontheme.cpp.

References dir(), KGlobal::dirs(), QDir::entryList(), QDir::exists(), isValid(), and KStandardDirs::resourceDirs().

QString KIconTheme::current | ( |  | ) | `[static]`

Returns the current icon theme.

Returns:
  the name of the current theme

Definition at line 426 of file kicontheme.cpp.

References KGlobal::config(), defaultThemeName(), and KConfigBase::readEntry().

void KIconTheme::reconfigure | ( |  | ) | `[static]`

| Reconfigure the theme. Definition at line 481 of file kicontheme.cpp. Referenced by KInstance::newIconLoader().

QString KIconTheme::defaultThemeName | ( |  | ) | `[static]`

Returns the default icon theme.

Returns:
  the name of the default theme name

Since:
  3.1

Definition at line 490 of file kicontheme.cpp.

References QString::fromLatin1().

Referenced by current().

The documentation for this class was generated from the following files:

- kicontheme.h
- kicontheme.cpp

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:41 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003