diff options
| author | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-08-10 14:56:44 +0200 |
|---|---|---|
| committer | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-08-10 14:56:44 +0200 |
| commit | 6ae4c71032e6b15dedd631dfff0c0c4cc4a8522a (patch) | |
| tree | cd2c53b90bb13375df387414e99e6d8e7509e2a9 /rwa-support-desktopapp/src/RWAHostModel.cpp | |
| parent | afeb0381f568b4c9f51296cd5de325c8c8aac3f2 (diff) | |
| download | RWA.Support.DesktopApp-6ae4c71032e6b15dedd631dfff0c0c4cc4a8522a.tar.gz RWA.Support.DesktopApp-6ae4c71032e6b15dedd631dfff0c0c4cc4a8522a.tar.bz2 RWA.Support.DesktopApp-6ae4c71032e6b15dedd631dfff0c0c4cc4a8522a.zip | |
Complete restructure of current code tree
Diffstat (limited to 'rwa-support-desktopapp/src/RWAHostModel.cpp')
| -rw-r--r-- | rwa-support-desktopapp/src/RWAHostModel.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/rwa-support-desktopapp/src/RWAHostModel.cpp b/rwa-support-desktopapp/src/RWAHostModel.cpp new file mode 100644 index 0000000..5f62adc --- /dev/null +++ b/rwa-support-desktopapp/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(); +} |
