QIfMediaDeviceDiscoveryModel Class

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

Header: #include <QIfMediaDeviceDiscoveryModel>
qmake: QT += ifmedia
Instantiated By: MediaDeviceDiscoveryModel
Inherits: QIfAbstractFeatureListModel

Public Types

enum Roles { NameRole, TypeRole, ServiceObjectRole }

Properties

Public Functions

QIfMediaDeviceDiscoveryModel(QObject *parent = nullptr)
QIfMediaDevice *at(int i) const
QIfMediaDevice *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(QIfMediaDevice *device)
void deviceRemoved(QIfMediaDevice *device)

Reimplemented Protected Functions

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

Detailed Description

The QIfMediaDeviceDiscoveryModel 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 QIfMediaDevice.

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

Uses qtifmedia as configurationId for QIfConfiguration based settings.

Member Type Documentation

enum QIfMediaDeviceDiscoveryModel::Roles

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

Property Documentation

[read-only] 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

[explicit] QIfMediaDeviceDiscoveryModel::QIfMediaDeviceDiscoveryModel(QObject *parent = nullptr)

Constructs a QIfMediaDeviceDiscoveryModel.

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

QIfMediaDevice *QIfMediaDeviceDiscoveryModel::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 QIfMediaDeviceDiscoveryModel::clearServiceObject()

Reimplements: QIfAbstractFeatureListModel::clearServiceObject().

[override virtual protected] void QIfMediaDeviceDiscoveryModel::connectToServiceObject(QIfServiceObject *serviceObject)

Reimplements: QIfAbstractFeatureListModel::connectToServiceObject(QIfServiceObject *serviceObject).

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

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

[signal] void QIfMediaDeviceDiscoveryModel::deviceAdded(QIfMediaDevice *device)

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

[signal] void QIfMediaDeviceDiscoveryModel::deviceRemoved(QIfMediaDevice *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.

[invokable] QIfMediaDevice *QIfMediaDeviceDiscoveryModel::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> QIfMediaDeviceDiscoveryModel::roleNames() const

Reimplements: QAbstractItemModel::roleNames() const.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.