From 5530945972f8315e531a6570fc5e251812af0fa6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 20 Mar 2017 13:16:47 +0100 Subject: [PATCH] #1323 Show context menu in Result Plot dock widget --- .../UserInterface/RiuResultQwtPlot.cpp | 23 +++++++++++++++++++ .../UserInterface/RiuResultQwtPlot.h | 1 + 2 files changed, 24 insertions(+) diff --git a/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp b/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp index 07b1b36ef7..6efc38bad3 100644 --- a/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuResultQwtPlot.cpp @@ -21,6 +21,8 @@ #include "RigCurveDataTools.h" +#include "RimContextCommandBuilder.h" + #include "RiuLineSegmentQwtPlotCurve.h" #include "cvfBase.h" @@ -35,6 +37,9 @@ #include "qwt_plot_layout.h" #include "qwt_scale_engine.h" +#include +#include + //-------------------------------------------------------------------------------------------------- /// @@ -124,6 +129,24 @@ QSize RiuResultQwtPlot::minimumSizeHint() const return QSize(0, 0); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuResultQwtPlot::contextMenuEvent(QContextMenuEvent* event) +{ + QMenu menu; + QStringList commandIds; + + commandIds << "RicNewGridTimeHistoryCurveFeature"; + + RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu); + + if (menu.actions().size() > 0) + { + menu.exec(event->globalPos()); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuResultQwtPlot.h b/ApplicationCode/UserInterface/RiuResultQwtPlot.h index 5e538d1ef1..7513b091f3 100644 --- a/ApplicationCode/UserInterface/RiuResultQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuResultQwtPlot.h @@ -48,6 +48,7 @@ public: protected: virtual QSize sizeHint() const; virtual QSize minimumSizeHint() const; + virtual void contextMenuEvent(QContextMenuEvent *) override; private: void setDefaults();