MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / registersForTable

Method registersForTable

app/src/DataModel/ProjectModel.cpp:5429–5450  ·  view source on GitHub ↗

* @brief Returns the register list of a table as a QVariantList for QML. */

Source from the content-addressed store, hash-verified

5427 * @brief Returns the register list of a table as a QVariantList for QML.
5428 */
5429QVariantList DataModel::ProjectModel::registersForTable(const QString& table) const
5430{
5431 QVariantList result;
5432 const int idx = findTableIndexByPath(table);
5433 if (idx < 0)
5434 return result;
5435
5436 auto it = m_tables.begin() + idx;
5437
5438 for (const auto& r : it->registers) {
5439 QVariantMap row;
5440 row["name"] = r.name;
5441 row["type"] =
5442 r.type == RegisterType::Computed ? QStringLiteral("computed") : QStringLiteral("constant");
5443 row["value"] = r.defaultValue;
5444 row["valueType"] = r.defaultValue.typeId() == QMetaType::Double ? QStringLiteral("number")
5445 : QStringLiteral("string");
5446 result.append(row);
5447 }
5448
5449 return result;
5450}
5451
5452//--------------------------------------------------------------------------------------------------
5453// QInputDialog wrappers

Callers 1

tableGetMethod · 0.80

Calls 2

beginMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected