@@ -1,3 +1,5 | |||
|
1 | #include <Variable/RenameVariableDialog.h> | |
|
2 | #include <Variable/Variable.h> | |
|
1 | 3 | #include <Variable/VariableController.h> |
|
2 | 4 | #include <Variable/VariableInspectorWidget.h> |
|
3 | 5 | #include <Variable/VariableMenuHeaderWidget.h> |
@@ -179,6 +181,16 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept | |||
|
179 | 181 | auto selectedVariable = selectedVariables.front(); |
|
180 | 182 | |
|
181 | 183 | auto renameFun = [&selectedVariable, &model, this]() { |
|
184 | // Generates forbidden names (names associated to existing variables) | |
|
185 | auto allVariables = model->variables(); | |
|
186 | auto forbiddenNames = QVector<QString>(allVariables.size()); | |
|
187 | std::transform(allVariables.cbegin(), allVariables.cend(), forbiddenNames.begin(), | |
|
188 | [](const auto &variable) { return variable->name(); }); | |
|
189 | ||
|
190 | RenameVariableDialog dialog{selectedVariable->name(), forbiddenNames, this}; | |
|
191 | if (dialog.exec() == QDialog::Accepted) { | |
|
192 | selectedVariable->setName(dialog.name()); | |
|
193 | } | |
|
182 | 194 | }; |
|
183 | 195 | |
|
184 | 196 | tableMenu.addAction(tr("Rename..."), renameFun); |
General Comments 0
You need to be logged in to leave comments.
Login now