Phonon.ObjectDescriptionModel

KDE 4.2 PyKDE API Reference

- KDE's Python API

# ObjectDescriptionModel Class Reference

`from PyKDE4.phonon import *`

Inherits: QAbstractListModel → QAbstractItemModel → QObject
Namespace: Phonon

## Detailed Description

## Attributes
QMetaObject | staticMetaObject
## Methods
| __init__ (self, QObject parent=0)
| __init__ (self, [ObjectDescription] data, QObject parent=0)
QVariant | data (self, QModelIndex index, int role=Qt.DisplayRole)
bool | dropMimeData (self, QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent)
Qt.ItemFlags | flags (self, QModelIndex index)
QMetaObject | metaObject (self)
QMimeData | mimeData (self, QModelIndexList indexes)
QStringList | mimeTypes (self)
[ObjectDescription] | modelData (self)
ObjectDescription | modelData (self, QModelIndex index)
| moveDown (self, QModelIndex index)
| moveUp (self, QModelIndex index)
void | qt_metacast (self, QString _clname)
bool | removeRows (self, int row, int count, QModelIndex parent=QModelIndex())
int | rowCount (self, QModelIndex parent=QModelIndex())
| setModelData (self, [ObjectDescription] data)
Qt.DropActions | supportedDropActions (self)
int | tupleIndexAtPositionIndex (self, int positionIndex)
[int] | tupleIndexOrder (self)

## Method Documentation

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

Constructs a ObjectDescription model with the given parent.

__init__ | ( | self, |
|  | [ObjectDescription] | data,
|  | QObject | parent=0
| ) |  |  |

Constructs a ObjectDescription model with the given parent and the given data.

QVariant data | ( | self, |
|  | QModelIndex | index,
|  | int | role=Qt.DisplayRole
| ) |  |  |

Returns data from the item with the given index for the specified role. If the view requests an invalid index, an invalid variant is returned.

Reimplemented from QAbstractItemModel.

See also:
  QAbstractItemModel.data

See also:
  Qt.ItemDataRole

bool dropMimeData | ( | self, |
|  | QMimeData | data,
|  | Qt.DropAction | action,
|  | int | row,
|  | int | column,
|  | QModelIndex | parent
| ) |  |  |

Accept drops from other models of the same ObjectDescriptionType.

If a valid parent is given the dropped items will be inserted above that item.

Qt.ItemFlags flags | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Reimplemented to show unavailable devices as disabled (but still selectable).

QMetaObject metaObject | ( |  | self ) |

QMimeData mimeData | ( | self, |
|  | QModelIndexList | indexes
| ) |  |  |

Returns the MIME data that dropMimeData() can use to create new items.

QStringList mimeTypes | ( |  | self ) |

Returns a list of supported drag and drop MIME types. Currently it only supports one type used internally.

[ObjectDescription] modelData | ( |  | self ) |

Returns the model data.

As the order of the list might have changed this can be different to what was set using setModelData().

ObjectDescription modelData | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Returns one ObjectDescription of the model data for the given index.

moveDown | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Moves the item at the given index down. In the resulting list the items at index.row() and index.row() + 1 are swapped.

Connected views are updated automatically.

moveUp | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Moves the item at the given index up. In the resulting list the items at index.row() and index.row() - 1 are swapped.

Connected views are updated automatically.

void qt_metacast | ( | self, |
|  | QString | _clname
| ) |  |  |

Internal:

bool removeRows | ( | self, |
|  | int | row,
|  | int | count,
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

Removes count rows starting with the given row.

If a valid parent is given no rows are removed since this is a list model.

Returns true if the rows were successfully removed; otherwise returns false.

int rowCount | ( | self, |
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

Returns the number of rows in the model. This value corresponds to the size of the list passed through setModelData.

Parameters:

  | parent | The optional parent argument is used in most models to specify the parent of the rows to be counted. Because this is a list if a valid parent is specified the result will always be 0.

Reimplemented from QAbstractItemModel.

See also:
  QAbstractItemModel.rowCount

setModelData | ( | self, |
|  | [ObjectDescription] | data
| ) |  |  |

Sets the model data using the list provided by data.

All previous model data is cleared.

Qt.DropActions supportedDropActions | ( |  | self ) |

This model supports drag and drop to copy or move items.

int tupleIndexAtPositionIndex | ( | self, |
|  | int | positionIndex
| ) |  |  |

Returns the ObjectDescription.index for the tuple at the given position positionIndex. For example a QComboBox will give you the currentIndex as the position in the list. But to select the according AudioOutputDevice using AudioOutputDevice.fromIndex you can use this method.

Parameters:

  | positionIndex | The position in the list.

[int] tupleIndexOrder | ( |  | self ) |

Returns a list of indexes in the same order as they are in the model. The indexes come from the ObjectDescription.index method.

This is useful to let the user define a list of preference.

## Attribute Documentation

QMetaObject staticMetaObject

Internal: