aboutsummaryrefslogtreecommitdiff
path: root/src/RWAHostModel.cpp
diff options
context:
space:
mode:
authorDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-08-09 12:34:48 +0000
committerDaniel Teichmann <daniel.teichmann@das-netzwerkteam.de>2021-08-09 12:34:48 +0000
commit607edbcd8689ea71ec57340204ed3d908a7cadbb (patch)
tree91961406adb5143e0c5072094d2d1a4846e6b6b0 /src/RWAHostModel.cpp
parent34abe223f7648929f0c6b9132fbdc83e0353b51a (diff)
parentfd5e881fdee35d21fd3e0728e5b927d04e64f459 (diff)
downloadRWA.Support.DesktopApp-607edbcd8689ea71ec57340204ed3d908a7cadbb.tar.gz
RWA.Support.DesktopApp-607edbcd8689ea71ec57340204ed3d908a7cadbb.tar.bz2
RWA.Support.DesktopApp-607edbcd8689ea71ec57340204ed3d908a7cadbb.zip
Merge branch 'mr/feature/gitlab-ci' into 'master'
Add .gitlab-ci.yml See merge request remotewebapp/rwa.support.desktopapp!2
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();
+}