From c69ca4df80c9c74aa842b7f1fb3c44b22ae3232e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 20 Mar 2019 07:31:24 -0700 Subject: Core: simplify ConnectionListModel The complicated setup with the AddressRole is unnecessary. All we want to be able to do is get the index of a specific text in the list. In hindsight I am puzzled why I implemented this in such a complex fashion. Signed-off-by: Dirk Hohndel --- core/connectionlistmodel.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'core/connectionlistmodel.cpp') diff --git a/core/connectionlistmodel.cpp b/core/connectionlistmodel.cpp index 3cc9c24f9..8cd270347 100644 --- a/core/connectionlistmodel.cpp +++ b/core/connectionlistmodel.cpp @@ -7,29 +7,15 @@ ConnectionListModel::ConnectionListModel(QObject *parent) : { } -QHash ConnectionListModel::roleNames() const -{ - QHash roles; - roles[AddressRole] = "address"; - return roles; -} - QVariant ConnectionListModel::data(const QModelIndex &index, int role) const { if (index.row() < 0 || index.row() >= m_addresses.count()) return QVariant(); - if (role != AddressRole) + if (role != Qt::DisplayRole) return QVariant(); return m_addresses[index.row()]; } -QString ConnectionListModel::address(int idx) const -{ - if (idx < 0 || idx >> m_addresses.count()) - return QString(); - return m_addresses[idx]; -} - int ConnectionListModel::rowCount(const QModelIndex&) const { return m_addresses.count(); -- cgit v1.2.3-70-g09d2