KDE 4.2 PyKDE API Reference

- KDE's Python API

# KExtendableItemDelegate Class Reference

`from PyKDE4.kdeui import *`

Inherits: QStyledItemDelegate → QAbstractItemDelegate → QObject

## Detailed Description

## Enumerations

auxDataRoles | { ShowExtensionIndicatorRole }

## Signals

| extenderCreated (QWidget extender, QModelIndex index)
| extenderDestroyed (QWidget extender, QModelIndex index)

## Methods

| __init__ (self, QAbstractItemView parent)
| contractAll (self)
| contractItem (self, QModelIndex index)
QPixmap | contractPixmap (self)
| extendItem (self, QWidget extender, QModelIndex index)
QPixmap | extendPixmap (self)
| extenderCreated (self, QWidget extender, QModelIndex index)
| extenderDestroyed (self, QWidget extender, QModelIndex index)
QRect | extenderRect (self, QWidget extender, QStyleOptionViewItem option, QModelIndex index)
bool | isExtended (self, QModelIndex index)
| paint (self, QPainter painter, QStyleOptionViewItem option, QModelIndex index)
| setContractPixmap (self, QPixmap pixmap)
| setExtendPixmap (self, QPixmap pixmap)
QSize | sizeHint (self, QStyleOptionViewItem option, QModelIndex index)
| updateExtenderGeometry (self, QWidget extender, QStyleOptionViewItem option, QModelIndex index)

## Method Documentation

__init__ | ( | self, |
|  | QAbstractItemView | parent
| ) |  |  |

Create a new KExtendableItemDelegate that belongs to parent. In contrast to generic QAbstractItemDelegates, an instance of this class can only ever be the delegate for one instance of af QAbstractItemView subclass.

contractAll | ( |  | self ) |

Close all extenders and delete all extender widgets.

contractItem | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Remove the extender of item at index from the view. The extender widget will be deleted.

QPixmap contractPixmap | ( |  | self ) |

Return the pixmap that is displayed to contract an item.

extendItem | ( | self, |
|  | QWidget | extender,
|  | QModelIndex | index
| ) |  |  |

Insert the extender for item at index into the view. If you need a parent for the extender at construction time, use the itemview's viewport(). The delegate takes ownership of the extender; the extender will also be reparented and resized to the viewport.

QPixmap extendPixmap | ( |  | self ) |

Return the pixmap that is displayed to extend an item.

extenderCreated | ( | self, |
|  | QWidget | extender,
|  | QModelIndex | index
| ) |  |  |

This signal indicates that the item at index was extended with extender.

Signal syntax:
  `QObject.connect(source, SIGNAL("extenderCreated(QWidget*, const QModelIndex&)"), target_slot)`

extenderDestroyed | ( | self, |
|  | QWidget | extender,
|  | QModelIndex | index
| ) |  |  |

This signal indicates that the extender belonging to index has emitted the destroyed() signal.

Signal syntax:
  `QObject.connect(source, SIGNAL("extenderDestroyed(QWidget*, const QModelIndex&)"), target_slot)`

QRect extenderRect | ( | self, |
|  | QWidget | extender,
|  | QStyleOptionViewItem | option,
|  | QModelIndex | index
| ) |  |  |

Reimplement this function to fine-tune the position of the extender. option.rect will be a rectangle that is as wide as the viewport and as high as the usual item height plus the extender size hint's height. Its upper left corner will be at the upper left corner of the usual item. You can place the returned rectangle of this function anywhere inside that area.

bool isExtended | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Return whether there is an extender that belongs to index.

paint | ( | self, |
|  | QPainter | painter,
|  | QStyleOptionViewItem | option,
|  | QModelIndex | index
| ) |  |  |

Re-implemented for internal reasons. API not affected.

setContractPixmap | ( | self, |
|  | QPixmap | pixmap
| ) |  |  |

The pixmap that is displayed to contract an item. pixmap must have the same size as the pixmap in setExtendPixmap.

setExtendPixmap | ( | self, |
|  | QPixmap | pixmap
| ) |  |  |

The pixmap that is displayed to extend an item. pixmap must have the same size as the pixmap in setContractPixmap.

QSize sizeHint | ( | self, |
|  | QStyleOptionViewItem | option,
|  | QModelIndex | index
| ) |  |  |

Re-implemented for internal reasons. API not affected.

updateExtenderGeometry | ( | self, |
|  | QWidget | extender,
|  | QStyleOptionViewItem | option,
|  | QModelIndex | index
| ) |  |  |

Reimplement this function to adjust the internal geometry of the extender. The external geometry of the extender will be set by the delegate.

## Enumeration Documentation

auxDataRoles

Enumerator:

  ShowExtensionIndicatorRole = Qt::UserRole+200 |