##// END OF EJS Templates
Notifies view when a variable is added to the model
Alexandre Leroux -
r144:1e9e83c4ae20
parent child
Show More
@@ -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 4
Under Review
author

Pull request updated. Auto status change to "Under Review"

Changed commits:
  * 1 added
  * 0 removed

Changed files:
  * M core/src/Variable/VariableModel.cpp
Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now