@@ -1,26 +1,35 | |||||
1 | #ifndef SCIQLOP_VARIABLEINSPECTORWIDGET_H |
|
1 | #ifndef SCIQLOP_VARIABLEINSPECTORWIDGET_H | |
2 | #define SCIQLOP_VARIABLEINSPECTORWIDGET_H |
|
2 | #define SCIQLOP_VARIABLEINSPECTORWIDGET_H | |
3 |
|
3 | |||
|
4 | #include <QMenu> | |||
4 | #include <QWidget> |
|
5 | #include <QWidget> | |
5 |
|
6 | |||
|
7 | #include <memory> | |||
|
8 | ||||
|
9 | class Variable; | |||
|
10 | ||||
6 | namespace Ui { |
|
11 | namespace Ui { | |
7 | class VariableInspectorWidget; |
|
12 | class VariableInspectorWidget; | |
8 | } // Ui |
|
13 | } // Ui | |
9 |
|
14 | |||
10 | /** |
|
15 | /** | |
11 | * @brief The VariableInspectorWidget class representes represents the variable inspector, from |
|
16 | * @brief The VariableInspectorWidget class representes represents the variable inspector, from | |
12 | * which it is possible to view the loaded variables, handle them or trigger their display in |
|
17 | * which it is possible to view the loaded variables, handle them or trigger their display in | |
13 | * visualization |
|
18 | * visualization | |
14 | */ |
|
19 | */ | |
15 | class VariableInspectorWidget : public QWidget { |
|
20 | class VariableInspectorWidget : public QWidget { | |
16 | Q_OBJECT |
|
21 | Q_OBJECT | |
17 |
|
22 | |||
18 | public: |
|
23 | public: | |
19 | explicit VariableInspectorWidget(QWidget *parent = 0); |
|
24 | explicit VariableInspectorWidget(QWidget *parent = 0); | |
20 | virtual ~VariableInspectorWidget(); |
|
25 | virtual ~VariableInspectorWidget(); | |
21 |
|
26 | |||
22 | private: |
|
27 | private: | |
23 | Ui::VariableInspectorWidget *ui; |
|
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 | #endif // SCIQLOP_VARIABLEINSPECTORWIDGET_H |
|
35 | #endif // SCIQLOP_VARIABLEINSPECTORWIDGET_H |
@@ -1,26 +1,35 | |||||
1 | #include <Variable/VariableController.h> |
|
1 | #include <Variable/VariableController.h> | |
2 | #include <Variable/VariableInspectorWidget.h> |
|
2 | #include <Variable/VariableInspectorWidget.h> | |
3 | #include <Variable/VariableModel.h> |
|
3 | #include <Variable/VariableModel.h> | |
4 |
|
4 | |||
5 | #include <ui_VariableInspectorWidget.h> |
|
5 | #include <ui_VariableInspectorWidget.h> | |
6 |
|
6 | |||
7 | #include <QSortFilterProxyModel> |
|
7 | #include <QSortFilterProxyModel> | |
8 |
|
8 | |||
9 | #include <SqpApplication.h> |
|
9 | #include <SqpApplication.h> | |
10 |
|
10 | |||
11 | VariableInspectorWidget::VariableInspectorWidget(QWidget *parent) |
|
11 | VariableInspectorWidget::VariableInspectorWidget(QWidget *parent) | |
12 | : QWidget{parent}, ui{new Ui::VariableInspectorWidget} |
|
12 | : QWidget{parent}, ui{new Ui::VariableInspectorWidget} | |
13 | { |
|
13 | { | |
14 | ui->setupUi(this); |
|
14 | ui->setupUi(this); | |
15 |
|
15 | |||
16 | // Sets model for table |
|
16 | // Sets model for table | |
17 | auto sortFilterModel = new QSortFilterProxyModel{this}; |
|
17 | auto sortFilterModel = new QSortFilterProxyModel{this}; | |
18 | sortFilterModel->setSourceModel(sqpApp->variableController().variableModel()); |
|
18 | sortFilterModel->setSourceModel(sqpApp->variableController().variableModel()); | |
19 |
|
19 | |||
20 | ui->tableView->setModel(sortFilterModel); |
|
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 | VariableInspectorWidget::~VariableInspectorWidget() |
|
28 | VariableInspectorWidget::~VariableInspectorWidget() | |
24 | { |
|
29 | { | |
25 | delete ui; |
|
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