Mobile: reinstate roleNames function in ConnectionListModel

Commit c69ca4df80 removed the roleNames
function, which is not needed according to the docs, as a default function
is provided. For unknown reasons this broke the QML combo box.

Reinstate the function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-04-16 09:47:28 +02:00 committed by Dirk Hohndel
parent aa86d47e47
commit 15b2dbede4
2 changed files with 8 additions and 0 deletions

View file

@ -7,6 +7,13 @@ ConnectionListModel::ConnectionListModel(QObject *parent) :
{ {
} }
QHash <int, QByteArray> ConnectionListModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[Qt::DisplayRole] = "display";
return roles;
}
QVariant ConnectionListModel::data(const QModelIndex &index, int role) const QVariant ConnectionListModel::data(const QModelIndex &index, int role) const
{ {
if (index.row() < 0 || index.row() >= m_addresses.count()) if (index.row() < 0 || index.row() >= m_addresses.count())

View file

@ -7,6 +7,7 @@ class ConnectionListModel : public QAbstractListModel {
Q_OBJECT Q_OBJECT
public: public:
ConnectionListModel(QObject *parent = nullptr); ConnectionListModel(QObject *parent = nullptr);
QHash<int, QByteArray> roleNames() const override;
QVariant data(const QModelIndex &index, int role) const override; QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
void addAddress(const QString &address); void addAddress(const QString &address);