KDeviceListModel

KDE 4.9 PyKDE API Reference

- KDE's Python API

# KDeviceListModel Class Reference

`from PyKDE4.kio import *`

Inherits: QAbstractItemModel → QObject

## Detailed Description

Device list model in Qt's Interview framework.

This class is a tree view model. Each device has a parent excluding the main device(the computer). Only revelant when used with QTreeView.

Author:
  Michaël Larouche <michael.larouche@kdemail.net>

## Signals
| modelInitialized ()
## Methods
| __init__ (self, QObject parent=0)
| __init__ (self, QString predicate, QObject parent=0)
| __init__ (self, Solid.Predicate predicate, QObject parent=0)
int | columnCount (self, QModelIndex parent=QModelIndex())
QVariant | data (self, QModelIndex index, int role)
Solid.Device | deviceForIndex (self, QModelIndex index)
QVariant | headerData (self, int section, Qt::Orientation orientation, int role=Qt.DisplayRole)
QModelIndex | index (self, int row, int column, QModelIndex parent=QModelIndex())
QModelIndex | parent (self, QModelIndex child)
QModelIndex | rootIndex (self)
int | rowCount (self, QModelIndex parent=QModelIndex())

## Signal Documentation

modelInitialized | ( |  | ) |

Signal syntax:
  `QObject.connect(source, SIGNAL("modelInitialized()"), target_slot)`

## Method Documentation

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

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

__init__ | ( | self, |
|  | Solid.Predicate | predicate,
|  | QObject | parent=0
| ) |  |  |

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

Get the number of columns for a model index.

QVariant data | ( | self, |
|  | QModelIndex | index,
|  | int | role
| ) |  |  |

Get a visible data based on Qt role for the given index. Return the device information for the give index.

Parameters:

  | index | The QModelIndex which contains the row, column to fetch the data.
  | role | The Interview data role(ex: Qt.DisplayRole).

Returns:
  the data for the given index and role.

Solid.Device deviceForIndex | ( | self, |
|  | QModelIndex | index
| ) |  |  |

QVariant headerData | ( | self, |
|  | int | section,
|  | Qt::Orientation | orientation,
|  | int | role=Qt.DisplayRole
| ) |  |  |

Get the header data for a given section, orientation and role. This method return a value to display in header in a view. Only support Qt.Horizontal direction and Qt.DisplayRole role.

Parameters:

  | section | Section of Header to get the data of.
  | orientation | Orientation of the header.
  | role | The Interview data role(ex: Qt.DisplayRole).

Returns:
  the header data for the given section.

QModelIndex index | ( | self, |
|  | int | row,
|  | int | column,
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

Get the children model index for the given row and column.

QModelIndex parent | ( | self, |
|  | QModelIndex | child
| ) |  |  |

Get the parent QModelIndex for the given model child.

QModelIndex rootIndex | ( |  | self ) |

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

Get the number of rows for a model index.