##// END OF EJS Templates
Adds header in the menu
Alexandre Leroux -
r268:c7a8f2384d1c
parent child
Show More
@@ -1,10 +1,12
1 #include <Variable/VariableController.h>
1 #include <Variable/VariableController.h>
2 #include <Variable/VariableInspectorWidget.h>
2 #include <Variable/VariableInspectorWidget.h>
3 #include <Variable/VariableMenuHeaderWidget.h>
3 #include <Variable/VariableModel.h>
4 #include <Variable/VariableModel.h>
4
5
5 #include <ui_VariableInspectorWidget.h>
6 #include <ui_VariableInspectorWidget.h>
6
7
7 #include <QSortFilterProxyModel>
8 #include <QSortFilterProxyModel>
9 #include <QWidgetAction>
8
10
9 #include <SqpApplication.h>
11 #include <SqpApplication.h>
10
12
@@ -63,6 +65,12 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
63 emit tableMenuAboutToBeDisplayed(&tableMenu, selectedVariables);
65 emit tableMenuAboutToBeDisplayed(&tableMenu, selectedVariables);
64
66
65 if (!tableMenu.isEmpty()) {
67 if (!tableMenu.isEmpty()) {
68 // Generates menu header (inserted before first action)
69 auto firstAction = tableMenu.actions().first();
70 auto headerAction = new QWidgetAction{&tableMenu};
71 headerAction->setDefaultWidget(new VariableMenuHeaderWidget{selectedVariables, &tableMenu});
72 tableMenu.insertAction(firstAction, headerAction);
73
66 // Displays menu
74 // Displays menu
67 tableMenu.exec(mapToGlobal(pos));
75 tableMenu.exec(mapToGlobal(pos));
68 }
76 }
General Comments 0
You need to be logged in to leave comments. Login now