Skip to content

Class SerialPortModel

ClassList > SerialPortModel

More...

  • #include <serialportmodel.h>

Inherits the following classes: QAbstractListModel

Public Types

Type Name
enum Roles
The roles provided by this model.

Public Functions

Type Name
SerialPortModel (QObject * parent=nullptr)
QVariant data (const QModelIndex & index, int role=Qt::DisplayRole) override const
Q_INVOKABLE int findIndexFromName (const QString & name) const
Q_INVOKABLE void refresh ()
QHash< int, QByteArray > roleNames () override const
int rowCount (const QModelIndex & parent=QModelIndex()) override const

Detailed Description

A model that provides serial ports available on the device.

Public Types Documentation

enum Roles

The roles provided by this model.

enum SerialPortModel::Roles {
    PortNameRole = Qt::UserRole + 1,
    DescriptionRole
};

Public Functions Documentation

function SerialPortModel

explicit SerialPortModel::SerialPortModel (
    QObject * parent=nullptr
) 

function data

QVariant SerialPortModel::data (
    const QModelIndex & index,
    int role=Qt::DisplayRole
) override const

function findIndexFromName

Q_INVOKABLE int SerialPortModel::findIndexFromName (
    const QString & name
) const

Returns the row index for a given serial port name.


function refresh

Q_INVOKABLE void SerialPortModel::refresh () 

Refresh the list of available serial ports.


function roleNames

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

function rowCount

int SerialPortModel::rowCount (
    const QModelIndex & parent=QModelIndex()
) override const


The documentation for this class was generated from the following file src/core/positioning/serialportmodel.h