Browse Source

Add get probe names to database manager

pull/1/head
miladS 1 year ago
parent
commit
9023678656
  1. 1
      logic/include/model/DatabaseManager.h
  2. 22
      logic/src/model/DatabaseManager.cpp

1
logic/include/model/DatabaseManager.h

@ -14,6 +14,7 @@ public:
~DatabaseManager(); ~DatabaseManager();
QList<QVariant> getProbeIds(); QList<QVariant> getProbeIds();
QList<QVariant> getProbeNames();
}; };
#endif //DATABASEMANAGER_H #endif //DATABASEMANAGER_H

22
logic/src/model/DatabaseManager.cpp

@ -45,3 +45,25 @@ QList<QVariant> DatabaseManager::getProbeIds()
return globalIds; return globalIds;
} }
/*************************************************************************************************/
QList<QVariant> DatabaseManager::getProbeNames()
{
QList<QVariant> 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;
}

Loading…
Cancel
Save