Phonon::ObjectDescriptionModelData

Search for usage in LXR

Phonon::ObjectDescriptionModelData Class Reference

#include <phonon/ObjectDescriptionModelData>

Public Member Functions

 ObjectDescriptionModelData (QAbstractListModel *)
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
bool dropMimeData (ObjectDescriptionType type, const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 
Qt::ItemFlags flags (const QModelIndex &index) const
 
QMimeDatamimeData (ObjectDescriptionType type, const QModelIndexList &indexes) const
 
QStringList mimeTypes (ObjectDescriptionType type) const
 
QList< QExplicitlySharedDataPointer< ObjectDescriptionData > > modelData () const
 
QExplicitlySharedDataPointer< ObjectDescriptionDatamodelData (const QModelIndex &index) const
 
void moveDown (const QModelIndex &index)
 
void moveUp (const QModelIndex &index)
 
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex())
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 
void setModelData (const QList< QExplicitlySharedDataPointer< ObjectDescriptionData > > &data)
 
Qt::DropActions supportedDropActions () const
 
int tupleIndexAtPositionIndex (int positionIndex) const
 
QList< int > tupleIndexOrder () const
 

Protected Attributes

ObjectDescriptionModelDataPrivate *const d
 

Detailed Description

Data class for models for ObjectDescription objects.

Author
Matthias Kretz kretz.nosp@m.@kde.nosp@m..org

Definition at line 46 of file objectdescriptionmodel.h.

Constructor & Destructor Documentation

◆ ObjectDescriptionModelData()

Phonon::ObjectDescriptionModelData::ObjectDescriptionModelData ( QAbstractListModel * model)

Definition at line 287 of file objectdescriptionmodel.cpp.

◆ ~ObjectDescriptionModelData()

Phonon::ObjectDescriptionModelData::~ObjectDescriptionModelData ( )
protected

Definition at line 292 of file objectdescriptionmodel.cpp.

Member Function Documentation

◆ data()

QVariant Phonon::ObjectDescriptionModelData::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const

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
Qt::ItemDataRole

Definition at line 158 of file objectdescriptionmodel.cpp.

◆ dropMimeData()

bool Phonon::ObjectDescriptionModelData::dropMimeData ( ObjectDescriptionType type,
const QMimeData * data,
Qt::DropAction action,
int row,
int column,
const QModelIndex & parent )

Definition at line 323 of file objectdescriptionmodel.cpp.

◆ flags()

Qt::ItemFlags Phonon::ObjectDescriptionModelData::flags ( const QModelIndex & index) const

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

Definition at line 205 of file objectdescriptionmodel.cpp.

◆ mimeData()

QMimeData * Phonon::ObjectDescriptionModelData::mimeData ( ObjectDescriptionType type,
const QModelIndexList & indexes ) const

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

Definition at line 232 of file objectdescriptionmodel.cpp.

◆ mimeTypes()

QStringList Phonon::ObjectDescriptionModelData::mimeTypes ( ObjectDescriptionType type) const

Definition at line 394 of file objectdescriptionmodel.cpp.

◆ modelData() [1/2]

QList< QExplicitlySharedDataPointer< ObjectDescriptionData > > Phonon::ObjectDescriptionModelData::modelData ( ) const

Definition at line 304 of file objectdescriptionmodel.cpp.

◆ modelData() [2/2]

QExplicitlySharedDataPointer< ObjectDescriptionData > Phonon::ObjectDescriptionModelData::modelData ( const QModelIndex & index) const

Definition at line 309 of file objectdescriptionmodel.cpp.

◆ moveDown()

void Phonon::ObjectDescriptionModelData::moveDown ( const 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.

Definition at line 268 of file objectdescriptionmodel.cpp.

◆ moveUp()

void Phonon::ObjectDescriptionModelData::moveUp ( const 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.

Definition at line 249 of file objectdescriptionmodel.cpp.

◆ removeRows()

bool Phonon::ObjectDescriptionModelData::removeRows ( int row,
int count,
const QModelIndex & parent = QModelIndex() )

Definition at line 363 of file objectdescriptionmodel.cpp.

◆ rowCount()

int Phonon::ObjectDescriptionModelData::rowCount ( const QModelIndex & parent = QModelIndex()) const

Returns the number of rows in the model.

This value corresponds to the size of the list passed through setModelData.

Parameters
parentThe 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

Definition at line 150 of file objectdescriptionmodel.cpp.

◆ setModelData()

void Phonon::ObjectDescriptionModelData::setModelData ( const QList< QExplicitlySharedDataPointer< ObjectDescriptionData > > & data)

Definition at line 297 of file objectdescriptionmodel.cpp.

◆ supportedDropActions()

Qt::DropActions Phonon::ObjectDescriptionModelData::supportedDropActions ( ) const

Definition at line 317 of file objectdescriptionmodel.cpp.

◆ tupleIndexAtPositionIndex()

int Phonon::ObjectDescriptionModelData::tupleIndexAtPositionIndex ( int positionIndex) const

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
positionIndexThe position in the list.

Definition at line 227 of file objectdescriptionmodel.cpp.

◆ tupleIndexOrder()

QList< int > Phonon::ObjectDescriptionModelData::tupleIndexOrder ( ) const

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.

Definition at line 218 of file objectdescriptionmodel.cpp.

Member Data Documentation

◆ d

ObjectDescriptionModelDataPrivate* const Phonon::ObjectDescriptionModelData::d
protected

Definition at line 137 of file objectdescriptionmodel.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:53:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.