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>
This commit is contained in:
Jan Mulder 2017-10-11 19:31:45 +02:00
parent f7d120e39c
commit 8b8863b640
2 changed files with 8 additions and 0 deletions

View file

@ -42,3 +42,10 @@ void ConnectionListModel::addAddress(const QString address)
m_addresses.append(address);
endInsertRows();
}
void ConnectionListModel::removeAllAddresses()
{
beginRemoveRows(QModelIndex(), 0, rowCount());
m_addresses.clear();
endRemoveRows();
}

View file

@ -15,6 +15,7 @@ public:
QString address(int idx) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
void addAddress(const QString address);
void removeAllAddresses();
private:
QStringList m_addresses;
};