##// END OF EJS Templates
Adds selection zone actions in the context menu
trabillard -
r1112:77b0e391c46a
parent child
Show More
@@ -10,6 +10,7
10 #include "Visualization/VisualizationZoneWidget.h"
10 #include "Visualization/VisualizationZoneWidget.h"
11 #include "ui_VisualizationGraphWidget.h"
11 #include "ui_VisualizationGraphWidget.h"
12
12
13 #include <Actions/ActionsGuiController.h>
13 #include <Common/MimeTypesDef.h>
14 #include <Common/MimeTypesDef.h>
14 #include <Data/ArrayData.h>
15 #include <Data/ArrayData.h>
15 #include <Data/IDataSeries.h>
16 #include <Data/IDataSeries.h>
@@ -602,6 +603,22 void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept
602 graphMenu.addAction(tr("Undo Zoom"), [this]() { undoZoom(); });
603 graphMenu.addAction(tr("Undo Zoom"), [this]() { undoZoom(); });
603 }
604 }
604
605
606 auto selectionZoneItem = impl->selectionZoneAt(pos, plot());
607 if (selectionZoneItem) {
608 auto selectedItems = parentVisualizationWidget()->selectionZoneManager().selectedItems();
609 auto zoneActions = sqpApp->actionsGuiController().selectionZoneActions();
610 if (!zoneActions.isEmpty() && !graphMenu.isEmpty()) {
611 graphMenu.addSeparator();
612 }
613
614 for (auto zoneAction : zoneActions) {
615 auto action = graphMenu.addAction(zoneAction->name());
616 QObject::connect(action, &QAction::triggered, [zoneAction, &selectedItems]() {
617 zoneAction->execute(selectedItems);
618 });
619 }
620 }
621
605 if (!graphMenu.isEmpty()) {
622 if (!graphMenu.isEmpty()) {
606 graphMenu.exec(QCursor::pos());
623 graphMenu.exec(QCursor::pos());
607 }
624 }
General Comments 4
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

Approved

Status change > Approved

You need to be logged in to leave comments. Login now