##// END OF EJS Templates
Activates menu on variable widget
Alexandre Leroux -
r228:4185018ede0d
parent child
Show More
@@ -1,26 +1,35
1 1 #ifndef SCIQLOP_VARIABLEINSPECTORWIDGET_H
2 2 #define SCIQLOP_VARIABLEINSPECTORWIDGET_H
3 3
4 #include <QMenu>
4 5 #include <QWidget>
5 6
7 #include <memory>
8
9 class Variable;
10
6 11 namespace Ui {
7 12 class VariableInspectorWidget;
8 13 } // Ui
9 14
10 15 /**
11 16 * @brief The VariableInspectorWidget class representes represents the variable inspector, from
12 17 * which it is possible to view the loaded variables, handle them or trigger their display in
13 18 * visualization
14 19 */
15 20 class VariableInspectorWidget : public QWidget {
16 21 Q_OBJECT
17 22
18 23 public:
19 24 explicit VariableInspectorWidget(QWidget *parent = 0);
20 25 virtual ~VariableInspectorWidget();
21 26
22 27 private:
23 28 Ui::VariableInspectorWidget *ui;
29
30 private slots:
31 /// Slot called when right clicking on an variable in the table (displays a menu)
32 void onTableMenuRequested(const QPoint &pos) noexcept;
24 33 };
25 34
26 35 #endif // SCIQLOP_VARIABLEINSPECTORWIDGET_H
@@ -1,26 +1,35
1 1 #include <Variable/VariableController.h>
2 2 #include <Variable/VariableInspectorWidget.h>
3 3 #include <Variable/VariableModel.h>
4 4
5 5 #include <ui_VariableInspectorWidget.h>
6 6
7 7 #include <QSortFilterProxyModel>
8 8
9 9 #include <SqpApplication.h>
10 10
11 11 VariableInspectorWidget::VariableInspectorWidget(QWidget *parent)
12 12 : QWidget{parent}, ui{new Ui::VariableInspectorWidget}
13 13 {
14 14 ui->setupUi(this);
15 15
16 16 // Sets model for table
17 17 auto sortFilterModel = new QSortFilterProxyModel{this};
18 18 sortFilterModel->setSourceModel(sqpApp->variableController().variableModel());
19 19
20 20 ui->tableView->setModel(sortFilterModel);
21
22 // Connection to show a menu when right clicking on the tree
23 ui->tableView->setContextMenuPolicy(Qt::CustomContextMenu);
24 connect(ui->tableView, &QTableView::customContextMenuRequested, this,
25 &VariableInspectorWidget::onTableMenuRequested);
21 26 }
22 27
23 28 VariableInspectorWidget::~VariableInspectorWidget()
24 29 {
25 30 delete ui;
26 31 }
32
33 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
34 {
35 }
General Comments 0
You need to be logged in to leave comments. Login now