subsurface/core/connectionlistmodel.h
Jan Mulder 8b8863b640 Add function to clear connectionModel data
Preparation primarily for mobile. When we want to switch in
one session from BT to cable connection and vise versa, we
need a way to clear the model data containing the possible
connections in use.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-12 09:32:12 +02:00

23 lines
589 B
C++

#ifndef CONNECTIONLISTMODEL_H
#define CONNECTIONLISTMODEL_H
#include <QAbstractListModel>
class ConnectionListModel : public QAbstractListModel {
Q_OBJECT
public:
enum CLMRole {
AddressRole = Qt::UserRole + 1
};
ConnectionListModel(QObject *parent = 0);
QHash<int, QByteArray> roleNames() const;
QVariant data(const QModelIndex &index, int role = AddressRole) const;
QString address(int idx) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
void addAddress(const QString address);
void removeAllAddresses();
private:
QStringList m_addresses;
};
#endif