From c7a8f2384d1c97b9c459ada9a536972e2069827d 2017-06-30 07:28:29 From: Alexandre Leroux Date: 2017-06-30 07:28:29 Subject: [PATCH] Adds header in the menu --- diff --git a/gui/src/Variable/VariableInspectorWidget.cpp b/gui/src/Variable/VariableInspectorWidget.cpp index dc0e91b..b41c187 100644 --- a/gui/src/Variable/VariableInspectorWidget.cpp +++ b/gui/src/Variable/VariableInspectorWidget.cpp @@ -1,10 +1,12 @@ #include #include +#include #include #include #include +#include #include @@ -63,6 +65,12 @@ void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept emit tableMenuAboutToBeDisplayed(&tableMenu, selectedVariables); if (!tableMenu.isEmpty()) { + // Generates menu header (inserted before first action) + auto firstAction = tableMenu.actions().first(); + auto headerAction = new QWidgetAction{&tableMenu}; + headerAction->setDefaultWidget(new VariableMenuHeaderWidget{selectedVariables, &tableMenu}); + tableMenu.insertAction(firstAction, headerAction); + // Displays menu tableMenu.exec(mapToGlobal(pos)); }