##// END OF EJS Templates
Retrieves the current selected variable when clicking on the variable widget
Alexandre Leroux -
r246:37254eb43d9f
parent child
Show More
@@ -32,6 +32,8 public:
32 32 createVariable(const QString &name, const SqpDateTime &dateTime,
33 33 std::unique_ptr<IDataSeries> defaultDataSeries) noexcept;
34 34
35 std::shared_ptr<Variable> variable(int index) const;
36
35 37 // /////////////////////////// //
36 38 // QAbstractTableModel methods //
37 39 // /////////////////////////// //
@@ -44,6 +44,11 VariableModel::createVariable(const QString &name, const SqpDateTime &dateTime,
44 44 return variable;
45 45 }
46 46
47 std::shared_ptr<Variable> VariableModel::variable(int index) const
48 {
49 return (index >= 0 && index < impl->m_Variables.size()) ? impl->m_Variables.at(index) : nullptr;
50 }
51
47 52 int VariableModel::columnCount(const QModelIndex &parent) const
48 53 {
49 54 Q_UNUSED(parent);
@@ -32,4 +32,18 VariableInspectorWidget::~VariableInspectorWidget()
32 32
33 33 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
34 34 {
35 auto selectedIndex = ui->tableView->indexAt(pos);
36 if (selectedIndex.isValid()) {
37 // Gets the model to retrieve the underlying selected variable
38 auto model = sqpApp->variableController().variableModel();
39 if (auto selectedVariable = model->variable(selectedIndex.row())) {
40 QMenu tableMenu{};
41
42 /// @todo ALX : make menu
43
44 if (!tableMenu.isEmpty()) {
45 tableMenu.exec(mapToGlobal(pos));
46 }
47 }
48 }
35 49 }
General Comments 0
You need to be logged in to leave comments. Login now