From 902367865611fa3eecc32e9cfc8e73e321d09121 Mon Sep 17 00:00:00 2001 From: miladS Date: Wed, 7 Feb 2024 09:17:48 +0330 Subject: [PATCH] Add get probe names to database manager --- logic/include/model/DatabaseManager.h | 1 + logic/src/model/DatabaseManager.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/logic/include/model/DatabaseManager.h b/logic/include/model/DatabaseManager.h index 06db604..891fc3f 100644 --- a/logic/include/model/DatabaseManager.h +++ b/logic/include/model/DatabaseManager.h @@ -14,6 +14,7 @@ public: ~DatabaseManager(); QList getProbeIds(); + QList getProbeNames(); }; #endif //DATABASEMANAGER_H diff --git a/logic/src/model/DatabaseManager.cpp b/logic/src/model/DatabaseManager.cpp index 7202706..30b9e30 100644 --- a/logic/src/model/DatabaseManager.cpp +++ b/logic/src/model/DatabaseManager.cpp @@ -45,3 +45,25 @@ QList DatabaseManager::getProbeIds() return globalIds; } + +/*************************************************************************************************/ +QList DatabaseManager::getProbeNames() +{ + QList names; + + QSqlQuery query; + if(query.exec("SELECT name FROM Probe")) + { + while(query.next()) + { + QString name = query.value(0).toString(); + names.append(QVariant(name)); + } + } + else + { + qDebug() << "Error executing query: " << query.lastError().text(); + } + + return names; +}