QIviMediaDeviceDiscoveryModel Class

Provides a model for discovering media devices. More...

Header: #include <QIviMediaDeviceDiscoveryModel>
qmake: QT += ivimedia
Instantiated By: MediaDeviceDiscoveryModel
Inherits: QIviAbstractFeatureListModel

Public Types

enum Roles { NameRole, TypeRole, ServiceObjectRole }

Properties

Public Functions

QIviMediaDeviceDiscoveryModel(QObject *parent = nullptr)
QIviMediaDevice *at(int i) const
QIviMediaDevice *get(int i) const

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role) const override
virtual QHash<int, QByteArray> roleNames() const override
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override

Signals

void countChanged()
void deviceAdded(QIviMediaDevice *device)
void deviceRemoved(QIviMediaDevice *device)

Reimplemented Protected Functions

virtual void clearServiceObject() override
virtual void connectToServiceObject(QIviServiceObject *serviceObject) override

Detailed Description

The QIviMediaDeviceDiscoveryModel provides a way to query for available media devices and to get notified when new media devices get added or are removed.

All devices listed here need to be a subclass of QIviMediaDevice.

The QIviMediaDeviceDiscoveryModel expects a single backend to be available. It is recommended to use it with discoveryMode set to QIviAbstractFeature::AutoDiscovery.

Member Type Documentation

enum QIviMediaDeviceDiscoveryModel::Roles

ConstantValueDescription
QIviMediaDeviceDiscoveryModel::NameRoleQt::DisplayRoleThe name of the media device. E.g. The name of the connected USB-Thumbdrive/SDCard or a connected Ipod.
QIviMediaDeviceDiscoveryModel::TypeRoleQt::UserRoleThe type of the media device. See SupportedMediaDevices for a detailed listing.
QIviMediaDeviceDiscoveryModel::ServiceObjectRoleQt::UserRole + 1A pointer to the media device itself. This pointer can be used as the ServiceObject for other Features. E.g. The QIviSearchAndBrowseModel.

Property Documentation

count : const int

Holds the current number of rows in this model.

Access functions:

virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override

Notifier signal:

void countChanged()

Member Function Documentation

QIviMediaDeviceDiscoveryModel::QIviMediaDeviceDiscoveryModel(QObject *parent = nullptr)

Constructs a QIviMediaDeviceDiscoveryModel.

The parent argument is passed on to the QIviAbstractFeatureListModel base class.

[signal] void QIviMediaDeviceDiscoveryModel::deviceAdded(QIviMediaDevice *device)

This signal is emitted whenever a new media device got added. The new media device is passed as device.

[signal] void QIviMediaDeviceDiscoveryModel::deviceRemoved(QIviMediaDevice *device)

This signal is emitted whenever a media device got removed. The device which got removed is passed as device. Afterwards the device will be deleted.

QIviMediaDevice *QIviMediaDeviceDiscoveryModel::at(int i) const

Returns the media device at index i.

Note: The returned device is owned by the model and can be deleted at any time.

[override virtual protected] void QIviMediaDeviceDiscoveryModel::clearServiceObject()

Reimplements: QIviAbstractFeatureListModel::clearServiceObject().

[override virtual protected] void QIviMediaDeviceDiscoveryModel::connectToServiceObject(QIviServiceObject *serviceObject)

Reimplements: QIviAbstractFeatureListModel::connectToServiceObject(QIviServiceObject *serviceObject).

[override virtual] QVariant QIviMediaDeviceDiscoveryModel::data(const QModelIndex &index, int role) const

Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

QIviMediaDevice *QIviMediaDeviceDiscoveryModel::get(int i) const

Returns the media device at index i.

Note: The returned device is owned by the model and can be deleted at any time.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[override virtual] QHash<int, QByteArray> QIviMediaDeviceDiscoveryModel::roleNames() const

Reimplements: QAbstractItemModel::roleNames() const.