aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-08 05:54:10 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-11 11:14:22 -0700
commit1bbbc07dd5a969554c6d4041593d7b7e3ad25e5f (patch)
treef0a5f5fb1718995f91e774c5e21f79ccad2b7963
parent842210c80d1618a78928fb2bf93cc4a4c77a3ccf (diff)
downloadsubsurface-1bbbc07dd5a969554c6d4041593d7b7e3ad25e5f.tar.gz
core: add indexOf member to ConnectionListModel
This will allow us to programatically set the connection in the QML UI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/connectionlistmodel.cpp5
-rw-r--r--core/connectionlistmodel.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/core/connectionlistmodel.cpp b/core/connectionlistmodel.cpp
index 04d1d5909..aaa829949 100644
--- a/core/connectionlistmodel.cpp
+++ b/core/connectionlistmodel.cpp
@@ -50,3 +50,8 @@ void ConnectionListModel::removeAllAddresses()
m_addresses.clear();
endRemoveRows();
}
+
+int ConnectionListModel::indexOf(QString address)
+{
+ return m_addresses.indexOf(address);
+}
diff --git a/core/connectionlistmodel.h b/core/connectionlistmodel.h
index b7b1db5c9..11a93bfbc 100644
--- a/core/connectionlistmodel.h
+++ b/core/connectionlistmodel.h
@@ -16,6 +16,7 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const;
void addAddress(const QString address);
void removeAllAddresses();
+ int indexOf(QString address);
private:
QStringList m_addresses;
};