aboutsummaryrefslogtreecommitdiff
path: root/src/RWAHostModel.cpp
diff options
context:
space:
mode:
authorDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-07-07 15:03:13 +0200
committerDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-07-07 15:40:01 +0200
commit54249d9c37ce3994b03123ee6367c7f5519d3b40 (patch)
treecb9657620cda008edaf87299b4b3878e757c097b /src/RWAHostModel.cpp
parent3b2c865566aea43ab21afadcd34f58db0a5d5ab8 (diff)
downloadRWA.Support.DesktopApp-54249d9c37ce3994b03123ee6367c7f5519d3b40.tar.gz
RWA.Support.DesktopApp-54249d9c37ce3994b03123ee6367c7f5519d3b40.tar.bz2
RWA.Support.DesktopApp-54249d9c37ce3994b03123ee6367c7f5519d3b40.zip
Introduce RWAHostModel. RWAHost's are now loaded on start.
Scene_remote_{view, control} are no longer available if no host is selected.
Diffstat (limited to 'src/RWAHostModel.cpp')
-rw-r--r--src/RWAHostModel.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/RWAHostModel.cpp b/src/RWAHostModel.cpp
new file mode 100644
index 0000000..5f62adc
--- /dev/null
+++ b/src/RWAHostModel.cpp
@@ -0,0 +1,37 @@
+#include "RWAHostModel.h"
+
+RWAHostModel::RWAHostModel(QObject *parent) {
+ Q_UNUSED(parent)
+}
+
+int RWAHostModel::rowCount(const QModelIndex& parent) const {
+ Q_UNUSED(parent);
+ return mDatas.size();
+}
+
+int RWAHostModel::columnCount(const QModelIndex& parent) const {
+ Q_UNUSED(parent);
+ return 1;
+}
+
+QVariant RWAHostModel::data(const QModelIndex &index, int role) const
+ {
+ if (!index.isValid())
+ return QVariant();
+ if ( role == Qt::DisplayRole) {
+ return mDatas[index.row()];
+ }
+ return QVariant();
+}
+
+void RWAHostModel::populate() {
+ beginResetModel();
+ mDatas.clear();
+ RWAHost *host1 = new RWAHost("uuid-1", "Erster Server", "url1");
+ RWAHost *host2 = new RWAHost("uuid-2", "Zweiter Server", "url2");
+ RWAHost *host3 = new RWAHost("uuid-3", "Dritter Server", "url3");
+ mDatas.append(host1->alias());
+ mDatas.append(host2->alias());
+ mDatas.append(host3->alias());
+ endResetModel();
+}