KDE 4.7 PyKDE API Reference

- KDE's Python API

# KIconDialog Class Reference

`from PyKDE4.kio import *`

Inherits: KDialog → QDialog → QWidget → QObject

## Detailed Description

Dialog for interactive selection of icons. Use the function getIcon() let the user select an icon.

An icon selection dialog.

## Signals

| newIconName (QString a0)

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, KIconLoader loader, QWidget parent=0)
| __init__ (self, KIconDialog a0)
int | iconSize (self)
QString | openDialog (self)
| setCustomLocation (self, QString location)
| setIconSize (self, int size)
| setStrictIconSize (self, bool b)
| setup (self, KIconLoader.Group group, KIconLoader.Context context=KIconLoader.Application, bool strictIconSize=0, int iconSize=0, bool user=0, bool lockUser=0, bool lockCustomDir=0)
| showDialog (self)
| slotOk (self)
bool | strictIconSize (self)

## Static Methods

QString | getIcon (KIconLoader.Group group=KIconLoader.Desktop, KIconLoader.Context context=KIconLoader.Application, bool strictIconSize=0, int iconSize=0, bool user=0, QWidget parent=0, QString caption=QString())

## Signal Documentation

newIconName | ( | QString | a0
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("newIconName(const QString&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Constructs an icon selection dialog using the global iconloader.

Parameters:

  | parent | The parent widget.

__init__ | ( | self, |
|  | KIconLoader | loader,
|  | QWidget | parent=0
| ) |  |  |

Constructs an icon selection dialog using a specific iconloader.

Parameters:

  | loader | The icon loader to use.
  | parent | The parent widget.

__init__ | ( | self, |
|  | KIconDialog | a0
| ) |  |  |

int iconSize | ( |  | self ) |

Returns the iconsize set via setIconSize() or 0, if the default iconsize will be used.

QString openDialog | ( |  | self ) |

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

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

See also:
  getIcon

setCustomLocation | ( | self, |
|  | QString | location
| ) |  |  |

sets a custom icon directory

setIconSize | ( | self, |
|  | int | size
| ) |  |  |

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

See also:
  KIconLoader.StdSizes

See also:
  iconSize

setStrictIconSize | ( | self, |
|  | 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.

setup | ( | self, |
|  | KIconLoader.Group | group,
|  | KIconLoader.Context | context=KIconLoader.Application,
|  | bool | strictIconSize=0,
|  | int | iconSize=0,
|  | bool | user=0,
|  | bool | lockUser=0,
|  | bool | lockCustomDir=0
| ) |  |  |

Allows you to set the same parameters as in the class method getIcon(), as well as two additional parameters to lock the choice between system and user dirs and to lock the custom user dir itself.

showDialog | ( |  | self ) |

show()es this dialog and emits a newIcon(const QString&) signal when successful. QString() will be emitted if the dialog was aborted.

slotOk | ( |  | self ) |

bool strictIconSize | ( |  | self ) |

Returns true if a strict icon size policy is set.

## Static Method Documentation

QString getIcon | ( | KIconLoader.Group | group=KIconLoader.Desktop,
|  | KIconLoader.Context | context=KIconLoader.Application,
|  | bool | strictIconSize=0,
|  | int | iconSize=0,
|  | bool | user=0,
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

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".
  | parent | The parent widget of the dialog.
  | caption | The caption to use for the dialog.

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