BluezQt 5.109.0
Public Types | Public Member Functions | List of all members
BluezQt::DevicesModel

Model of all devices. More...

#include <BluezQt/DevicesModel>

Public Types

enum  DeviceRoles {
  UbiRole = Qt::UserRole + 100 , AddressRole = Qt::UserRole + 101 , NameRole = Qt::UserRole + 102 , FriendlyNameRole = Qt::UserRole + 103 ,
  RemoteNameRole = Qt::UserRole + 104 , ClassRole = Qt::UserRole + 105 , TypeRole = Qt::UserRole + 106 , AppearanceRole = Qt::UserRole + 107 ,
  IconRole = Qt::UserRole + 108 , PairedRole = Qt::UserRole + 109 , TrustedRole = Qt::UserRole + 110 , BlockedRole = Qt::UserRole + 111 ,
  LegacyPairingRole = Qt::UserRole + 112 , RssiRole = Qt::UserRole + 113 , ConnectedRole = Qt::UserRole + 114 , UuidsRole = Qt::UserRole + 115 ,
  ModaliasRole = Qt::UserRole + 116 , AdapterNameRole = Qt::UserRole + 117 , AdapterAddressRole = Qt::UserRole + 118 , AdapterPoweredRole = Qt::UserRole + 119 ,
  AdapterDiscoverableRole = Qt::UserRole + 120 , AdapterPairableRole = Qt::UserRole + 121 , AdapterDiscoveringRole = Qt::UserRole + 122 , AdapterUuidsRole = Qt::UserRole + 123 ,
  LastRole = Qt::UserRole + 124
}
 Device data roles. More...
 

Public Member Functions

 DevicesModel (Manager *manager, QObject *parent=nullptr)
 Creates a new DevicesModel object.
 
 ~DevicesModel () override
 Destroys a DevicesModel object.
 
QVariant data (const QModelIndex &index, int role) const override
 Reimplemented from QAbstractListModel::data()
 
DevicePtr device (const QModelIndex &index) const
 Returns a device for specified index.
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 Reimplemented from QAbstractListModel::index()
 
QHash< int, QByteArray > roleNames () const override
 Reimplemented from QAbstractListModel::roleNames()
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Reimplemented from QAbstractListModel::rowCount()
 

Detailed Description

Model of all devices.

This class represents a model of all devices.

Example use in QML code:

import org.kde.bluezqt 1.0 as BluezQt
ListView {
model: BluezQt.DevicesModel { }
delegate: Text {
text: "%1 (%2)".arg(Name).arg(Address)
}
}

Member Enumeration Documentation

◆ DeviceRoles

Device data roles.

Enumerator
UbiRole 

UBI of the device (QString)

AddressRole 

Address of the device (QString)

NameRole 

Name of the device (QString)

FriendlyNameRole 

Friendly name of the device (QString)

RemoteNameRole 

Remote name of the device (QString)

ClassRole 

Class of the device (quint32)

TypeRole 

Type of the device (Device::Type)

AppearanceRole 

Appearance of the device (quint16)

IconRole 

Icon name of the device (QString)

PairedRole 

Indicates whether the device is paired (bool)

TrustedRole 

Indicates whether the device is trusted (bool)

BlockedRole 

Indicates whether the device is blocked (bool)

LegacyPairingRole 

Indicates whether the device has legacy pairing (bool)

RssiRole 

Received Signal Strength Indicator of the device (qint16)

ConnectedRole 

Indicates whether the device is connected (bool)

UuidsRole 

UUIDs of supported services by the device (QStringList)

ModaliasRole 

Modalias of the device (QString)

AdapterNameRole 

Name of the associated adapter (QString)

AdapterAddressRole 

Address of the associated adapter (QString)

AdapterPoweredRole 

Indicates whether the associated adapter is powered (bool)

AdapterDiscoverableRole 

Indicates whether the associated adapter is discoverable (bool)

AdapterPairableRole 

Indicates whether the associated adapter is pairable (bool)

AdapterDiscoveringRole 

Indicates whether the associated adapter is discovering (bool)

AdapterUuidsRole 

UUIDs of supported services by the associated adapter (QStringList)

LastRole 

Last role used by DevicesModel.

Constructor & Destructor Documentation

◆ DevicesModel()

BluezQt::DevicesModel::DevicesModel ( Manager manager,
QObject *  parent = nullptr 
)
explicit

Creates a new DevicesModel object.

Parameters
managermanager to be used
parent

◆ ~DevicesModel()

BluezQt::DevicesModel::~DevicesModel ( )
override

Destroys a DevicesModel object.

Member Function Documentation

◆ data()

QVariant BluezQt::DevicesModel::data ( const QModelIndex &  index,
int  role 
) const
override

Reimplemented from QAbstractListModel::data()

◆ device()

DevicePtr BluezQt::DevicesModel::device ( const QModelIndex &  index) const

Returns a device for specified index.

Parameters
indexindex in model
Returns
device object

◆ index()

QModelIndex BluezQt::DevicesModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

Reimplemented from QAbstractListModel::index()

◆ roleNames()

QHash< int, QByteArray > BluezQt::DevicesModel::roleNames ( ) const
override

Reimplemented from QAbstractListModel::roleNames()

◆ rowCount()

int BluezQt::DevicesModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Reimplemented from QAbstractListModel::rowCount()