@@ -26,12 +26,17 VariableModel::VariableModel(QObject *parent) | |||||
26 |
|
26 | |||
27 | Variable *VariableModel::createVariable(const QString &name) noexcept |
|
27 | Variable *VariableModel::createVariable(const QString &name) noexcept | |
28 | { |
|
28 | { | |
|
29 | auto insertIndex = rowCount(); | |||
|
30 | beginInsertRows({}, insertIndex, insertIndex); | |||
|
31 | ||||
29 | /// @todo For the moment, the other data of the variable is initialized with default values |
|
32 | /// @todo For the moment, the other data of the variable is initialized with default values | |
30 | auto variable |
|
33 | auto variable | |
31 | = std::make_unique<Variable>(name, QStringLiteral("unit"), QStringLiteral("mission")); |
|
34 | = std::make_unique<Variable>(name, QStringLiteral("unit"), QStringLiteral("mission")); | |
32 | impl->m_Variables.push_back(std::move(variable)); |
|
35 | impl->m_Variables.push_back(std::move(variable)); | |
33 |
|
36 | |||
34 | return impl->m_Variables.back().get(); |
|
37 | endInsertRows(); | |
|
38 | ||||
|
39 | return impl->m_Variables.at(insertIndex).get(); | |||
35 | } |
|
40 | } | |
36 |
|
41 | |||
37 | int VariableModel::columnCount(const QModelIndex &parent) const |
|
42 | int VariableModel::columnCount(const QModelIndex &parent) const |
General Comments 0
You need to be logged in to leave comments.
Login now