##// END OF EJS Templates
Adds header in the menu
Alexandre Leroux -
r268:c7a8f2384d1c
parent child
Show More
@@ -1,10 +1,12
1 1 #include <Variable/VariableController.h>
2 2 #include <Variable/VariableInspectorWidget.h>
3 #include <Variable/VariableMenuHeaderWidget.h>
3 4 #include <Variable/VariableModel.h>
4 5
5 6 #include <ui_VariableInspectorWidget.h>
6 7
7 8 #include <QSortFilterProxyModel>
9 #include <QWidgetAction>
8 10
9 11 #include <SqpApplication.h>
10 12
@@ -63,6 +65,12 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
63 65 emit tableMenuAboutToBeDisplayed(&tableMenu, selectedVariables);
64 66
65 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 74 // Displays menu
67 75 tableMenu.exec(mapToGlobal(pos));
68 76 }
General Comments 0
You need to be logged in to leave comments. Login now