KDE 4.9 PyKDE API Reference

- KDE's Python API

# KIconButton Class Reference

`from PyKDE4.kio import *`

Inherits: QPushButton → QAbstractButton → QWidget → QObject

## Detailed Description

A pushbutton for choosing an icon. Pressing on the button will open a KIconDialog for the user to select an icon. The current icon will be displayed on the button.

See also:
  KIconDialog

A push button that allows selection of an icon.

## Signals

| iconChanged (QString icon)

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, KIconLoader loader, QWidget parent)
| __init__ (self, KIconButton a0)
int | buttonIconSize (self)
QString | icon (self)
int | iconSize (self)
| resetIcon (self)
| setButtonIconSize (self, int size)
| setIcon (self, QString icon)
| setIcon (self, QIcon icon)
| setIconSize (self, int size)
| setIconType (self, KIconLoader.Group group, KIconLoader.Context context, bool user=0)
| setStrictIconSize (self, bool b)
bool | strictIconSize (self)

## Signal Documentation

iconChanged | ( | QString | icon
| ) |  |  |

Emitted when the icon has changed.

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

## Method Documentation

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

Constructs a KIconButton using the global iconloader.

Parameters:

  | parent | The parent widget.

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

Constructs a KIconButton using a specific KIconLoader.

Parameters:

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

__init__ | ( | self, |
|  | KIconButton | a0
| ) |  |  |

int buttonIconSize | ( |  | self ) |

Returns the Button's Icon-Size

Since:
  4.1

QString icon | ( |  | self ) |

Returns the name of the selected icon.

int iconSize | ( |  | self ) |

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

resetIcon | ( |  | self ) |

Resets the icon (reverts to an empty button).

setButtonIconSize | ( | self, |
|  | int | size
| ) |  |  |

Sets the size of the icon to be shown on the button

See also:
  KIconLoader.StdSizes

See also:
  buttonIconSize

Since:
  4.1

setIcon | ( | self, |
|  | QString | icon
| ) |  |  |

Sets the button's initial icon.

setIcon | ( | self, |
|  | QIcon | icon
| ) |  |  |

Sets the button's initial icon.

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

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

See also:
  KIconLoader.StdSizes

See also:
  iconSize

setIconType | ( | self, |
|  | KIconLoader.Group | group,
|  | KIconLoader.Context | context,
|  | bool | user=0
| ) |  |  |

Sets the icon group and context. Use KIconLoader.NoGroup if you want to allow icons for any group in the given context.

setStrictIconSize | ( | self, |
|  | bool | b
| ) |  |  |

Sets a strict icon size policy for allowed icons. When true, only icons of the specified group's size in setIconType are allowed, and only icons of that size will be shown in the icon dialog.

bool strictIconSize | ( |  | self ) |

Returns true if a strict icon size policy is set.