# kio Library API Documentation

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

# KIconDialog Class Reference

Dialog for interactive selection of icons. An icon selection dialog. More...

`#include <kicondialog.h>`

Inheritance diagram for KIconDialog:

[legend]
Collaboration diagram for KIconDialog:

[legend]
List of all members.

## Public Member Functions

| KIconDialog (QWidget *parent=0L, const char *name=0L)
| Constructs an icon selection dialog using the global iconloader.
| KIconDialog (KIconLoader *loader, QWidget *parent=0, const char *name=0)
| Constructs an icon selection dialog using a specific iconloader.
| ~KIconDialog ()
| Destructs the dialog.
void | setStrictIconSize (bool b)
| Sets a strict icon size policy for allowed icons.
bool | strictIconSize () const
| Returns true if a strict icon size policy is set.
void | setCustomLocation (const QString &location)

sets a custom icon directory

Since:
  3.1

void | setIconSize (int size)
| Sets the size of the icons to be shown / selected.
int | iconSize () const
| Returns the iconsize set via setIconSize() or 0, if the default iconsize will be used.
QString | selectIcon (KIcon::Group group=KIcon::Desktop, KIcon::Context context=KIcon::Application, bool user=false)
| This class or method is obsolete, it is provided for compatibility only. in KDE 3.0, use the static method getIcon instead.
void | setup (KIcon::Group group, KIcon::Context context=KIcon::Application, bool strictIconSize=false, int iconSize=0, bool user=false)
| Allows you to set the same parameters as in the class method getIcon().
QString | openDialog ()
| exec()utes this modal dialog and returns the name of the selected icon, or QString::null if the dialog was aborted.

## Static Public Member Functions

QString | getIcon (KIcon::Group group=KIcon::Desktop, KIcon::Context context=KIcon::Application, bool strictIconSize=false, int iconSize=0, bool user=false, QWidget *parent=0, const QString &caption=QString::null)
| Pops up the dialog an lets the user select an icon.

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)

## Detailed Description

Dialog for interactive selection of icons. An icon selection dialog.

Use the function getIcon() let the user select an icon.

Definition at line 92 of file kicondialog.h.

## Constructor & Destructor Documentation

KIconDialog::KIconDialog | ( | QWidget * | parent = 0L,
|  | const char * | name = 0L
| ) |

| Constructs an icon selection dialog using the global iconloader. Definition at line 198 of file kicondialog.cpp. References KGlobal::iconLoader(), and KStdAccel::name().

KIconDialog::KIconDialog | ( | KIconLoader * | loader,
|  | QWidget * | parent = 0,
|  | const char * | name = 0
| ) |

| Constructs an icon selection dialog using a specific iconloader. Definition at line 206 of file kicondialog.cpp. References KStdAccel::name().

KIconDialog::~KIconDialog | ( |  | ) |

| Destructs the dialog. Definition at line 271 of file kicondialog.cpp.

## Member Function Documentation

void KIconDialog::setStrictIconSize | ( | bool | b | ) |

| Sets a strict icon size policy for allowed icons. When true, only icons of the specified group's size in getIcon() are shown. When false, icons not available at the desired group's size will also be selectable. Definition at line 311 of file kicondialog.cpp.

bool KIconDialog::strictIconSize | ( |  | ) | const

| Returns true if a strict icon size policy is set. Definition at line 316 of file kicondialog.cpp.

void KIconDialog::setCustomLocation | ( | const QString & | location | ) |

sets a custom icon directory

Since:
  3.1

Definition at line 358 of file kicondialog.cpp.

Referenced by KIconButton::setIcon().

void KIconDialog::setIconSize | ( | int | size | ) |

Sets the size of the icons to be shown / selected.

See also:
  KIcon::StdSizes

  iconSize

Definition at line 321 of file kicondialog.cpp.

int KIconDialog::iconSize | ( |  | ) | const

| Returns the iconsize set via setIconSize() or 0, if the default iconsize will be used. Definition at line 330 of file kicondialog.cpp.

QString KIconDialog::selectIcon | ( | KIcon::Group | group = KIcon::Desktop,
|  | KIcon::Context | context = KIcon::Application,
|  | bool | user = false
| ) |

| This class or method is obsolete, it is provided for compatibility only. in KDE 3.0, use the static method getIcon instead. Definition at line 337 of file kicondialog.cpp. References openDialog(), and setup().

void KIconDialog::setup | ( | KIcon::Group | group,
|  | KIcon::Context | context = KIcon::Application,
|  | bool | strictIconSize = false,
|  | int | iconSize = 0,
|  | bool | user = false
| ) |

| Allows you to set the same parameters as in the class method getIcon(). Definition at line 344 of file kicondialog.cpp. References QRadioButton::setChecked(), and QComboBox::setCurrentItem(). Referenced by getIcon(), and selectIcon().

QString KIconDialog::openDialog | ( |  | ) |

exec()utes this modal dialog and returns the name of the selected icon, or QString::null if the dialog was aborted.

Returns:
  the name of the icon, suitable for loading with KIconLoader.

See also:
  getIcon

Definition at line 363 of file kicondialog.cpp.

References QFileInfo::baseName(), QDialog::exec(), KIconCanvas::getCurrent(), QString::isEmpty(), and KStdAccel::name().

Referenced by getIcon(), and selectIcon().

QString KIconDialog::getIcon | ( | KIcon::Group | group = KIcon::Desktop,
|  | KIcon::Context | context = KIcon::Application,
|  | bool | strictIconSize = false,
|  | int | iconSize = 0,
|  | bool | user = false,
|  | QWidget * | parent = 0,
|  | const QString & | caption = QString::null
| ) | `[static]`

Pops up the dialog an lets the user select an icon.

Parameters:

  group | The icon group this icon is intended for. Providing the group shows the icons in the dialog with the same appearance as when used outside the dialog.
  context | The initial icon context. Initially, the icons having this context are shown in the dialog. The user can change this.
  strictIconSize | When true, only icons of the specified group's size are shown, otherwise icon not available in the desired group's size will also be selectable.
  iconSize | the size of the icons -- the default of the icongroup if set to 0
  user | Begin with the "user icons" instead of "system icons".

Returns:
  The name of the icon, suitable for loading with KIconLoader.

Version:
  New in 3.0

Definition at line 380 of file kicondialog.cpp.

References QString::isNull(), openDialog(), KDialog::setCaption(), and setup().

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

- kicondialog.h
- kicondialog.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:18:43 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001