Phonon::ObjectDescriptionModel
#include <Phonon/ObjectDescriptionModel>
Static Public Attributes | |
static PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject | staticMetaObject |
Protected Attributes | |
ObjectDescriptionModelData *const | d |
Detailed Description
class Phonon::ObjectDescriptionModel< type >
The ObjectDescriptionModel class provides a model from a list of ObjectDescription objects.
ObjectDescriptionModel is a readonly model that supplies a list using ObjectDescription::name() for the text and ObjectDescription::description() for the tooltip. If set the properties "icon" and "available" are used to set the decoration and disable the item (disabled only visually, you can still select and drag it).
It also provides the methods moveUp() and moveDown() to order the list. Additionally drag and drop is possible so that QAbstractItemView::InternalMove can be used. The resulting order of the ObjectDescription::index() values can then be retrieved using tupleIndexOrder().
An example use case would be to give the user a QComboBox to select the output device:
And to retrieve the selected AudioOutputDevice:
Definition at line 191 of file objectdescriptionmodel.h.
Constructor & Destructor Documentation
◆ ObjectDescriptionModel() [1/2]
|
inlineexplicit |
Constructs a ObjectDescription model with the given parent
.
Definition at line 282 of file objectdescriptionmodel.h.
◆ ObjectDescriptionModel() [2/2]
|
inlineexplicit |
Constructs a ObjectDescription model with the given parent
and the given data
.
Definition at line 288 of file objectdescriptionmodel.h.
Member Function Documentation
◆ data()
|
inlineoverridevirtual |
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.
Implements QAbstractItemModel.
Definition at line 227 of file objectdescriptionmodel.h.
◆ dropMimeData()
|
inlineoverridevirtual |
Accept drops from other models of the same ObjectDescriptionType.
If a valid parent
is given the dropped items will be inserted above that item.
Reimplemented from QAbstractListModel.
Definition at line 336 of file objectdescriptionmodel.h.
◆ flags()
|
inlineoverridevirtual |
Reimplemented to show unavailable devices as disabled (but still selectable).
Reimplemented from QAbstractListModel.
Definition at line 233 of file objectdescriptionmodel.h.
◆ metaObject()
|
overridevirtual |
Reimplemented from QObject.
Definition at line 124 of file objectdescriptionmodel.cpp.
◆ mimeData()
|
inlineoverridevirtual |
Returns the MIME data that dropMimeData() can use to create new items.
Reimplemented from QAbstractItemModel.
Definition at line 260 of file objectdescriptionmodel.h.
◆ mimeTypes()
|
inlineoverridevirtual |
Returns a list of supported drag and drop MIME types.
Currently it only supports one type used internally.
Reimplemented from QAbstractItemModel.
Definition at line 356 of file objectdescriptionmodel.h.
◆ modelData() [1/2]
|
inline |
Returns the model data.
As the order of the list might have changed this can be different to what was set using setModelData().
Definition at line 310 of file objectdescriptionmodel.h.
◆ modelData() [2/2]
|
inline |
Returns one ObjectDescription of the model data for the given index
.
Definition at line 322 of file objectdescriptionmodel.h.
◆ moveDown()
|
inline |
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 276 of file objectdescriptionmodel.h.
◆ moveUp()
|
inline |
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 268 of file objectdescriptionmodel.h.
◆ qt_metacast()
|
override |
Definition at line 130 of file objectdescriptionmodel.cpp.
◆ removeRows()
|
inlineoverridevirtual |
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.
Reimplemented from QAbstractItemModel.
Definition at line 348 of file objectdescriptionmodel.h.
◆ rowCount()
|
inlineoverridevirtual |
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
Implements QAbstractItemModel.
Definition at line 214 of file objectdescriptionmodel.h.
◆ setModelData()
|
inline |
Sets the model data using the list provided by data
.
All previous model data is cleared.
Definition at line 296 of file objectdescriptionmodel.h.
◆ staticMetaObject() [1/6]
const QMetaObject Phonon::ObjectDescriptionModel< AudioOutputDeviceType >::staticMetaObject |
Definition at line 104 of file objectdescriptionmodel.cpp.
◆ staticMetaObject() [2/6]
const QMetaObject Phonon::ObjectDescriptionModel< AudioCaptureDeviceType >::staticMetaObject |
Definition at line 107 of file objectdescriptionmodel.cpp.
◆ staticMetaObject() [3/6]
const QMetaObject Phonon::ObjectDescriptionModel< VideoCaptureDeviceType >::staticMetaObject |
Definition at line 110 of file objectdescriptionmodel.cpp.
◆ staticMetaObject() [4/6]
const QMetaObject Phonon::ObjectDescriptionModel< EffectType >::staticMetaObject |
Definition at line 113 of file objectdescriptionmodel.cpp.
◆ staticMetaObject() [5/6]
const QMetaObject Phonon::ObjectDescriptionModel< AudioChannelType >::staticMetaObject |
Definition at line 116 of file objectdescriptionmodel.cpp.
◆ staticMetaObject() [6/6]
const QMetaObject Phonon::ObjectDescriptionModel< SubtitleType >::staticMetaObject |
Definition at line 119 of file objectdescriptionmodel.cpp.
◆ supportedDropActions()
|
inlineoverridevirtual |
This model supports drag and drop to copy or move items.
Reimplemented from QAbstractItemModel.
Definition at line 328 of file objectdescriptionmodel.h.
◆ tupleIndexAtPositionIndex()
|
inline |
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.
Definition at line 254 of file objectdescriptionmodel.h.
◆ tupleIndexOrder()
|
inline |
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 242 of file objectdescriptionmodel.h.
Member Data Documentation
◆ d
|
protected |
Definition at line 359 of file objectdescriptionmodel.h.
◆ staticMetaObject
|
static |
Definition at line 195 of file objectdescriptionmodel.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.