mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1293 Added "Show Plot Data" to context menu of plots
This commit is contained in:
parent
19e988925a
commit
141257c83e
@ -42,14 +42,11 @@ bool RicShowPlotDataFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimSummaryPlot*> selectedSummaryPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
|
||||
if (selectedSummaryPlots.size() > 0) return true;
|
||||
|
||||
std::vector<RimWellLogPlot*> wellLogPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
|
||||
|
||||
if (selectedSummaryPlots.size() > 0 || wellLogPlots.size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (wellLogPlots.size() > 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -402,16 +402,11 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
dynamic_cast<RimSummaryCurveFilter*>(uiItem) )
|
||||
{
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||
{
|
||||
// Do not add twice to make sure the first position in the menu is used for the action
|
||||
if (!commandIds.contains("RicAsciiExportSummaryPlotFeature"))
|
||||
{
|
||||
commandIds << "RicAsciiExportSummaryPlotFeature";
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAsciiExportWellLogPlotFeature";
|
||||
@ -501,6 +496,13 @@ void RimContextCommandBuilder::appendCommandsToMenu(const QStringList& commandId
|
||||
QAction* act = commandManager->action(commandIds[i]);
|
||||
CVF_ASSERT(act);
|
||||
|
||||
for (QAction* existingAct : menu->actions())
|
||||
{
|
||||
// If action exist, continue to make sure the action is positioned at the first
|
||||
// location of a command ID
|
||||
if (existingAct == act) continue;
|
||||
}
|
||||
|
||||
menu->addAction(act);
|
||||
}
|
||||
}
|
||||
|
@ -20,12 +20,15 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuQwtScalePicker.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "qwt_date_scale_draw.h"
|
||||
#include "qwt_date_scale_engine.h"
|
||||
#include "qwt_legend.h"
|
||||
@ -40,11 +43,9 @@
|
||||
#include "qwt_symbol.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include <float.h>
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -211,6 +212,16 @@ QSize RiuSummaryQwtPlot::minimumSizeHint() const
|
||||
return QSize(0, 100);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryQwtPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
QStringList commandIds;
|
||||
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition());
|
||||
commandIds << "RicShowPlotDataFeature";
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
if (menu.actions().size() > 0)
{
menu.exec(event->globalPos());
}
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -63,7 +63,7 @@ protected:
|
||||
|
||||
virtual QSize sizeHint() const override;
|
||||
virtual QSize minimumSizeHint() const override;
|
||||
|
||||
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
||||
private:
|
||||
friend class RiuQwtPlotPicker;
|
||||
QPointF closestCurvePoint(const QPoint& pos, QString* valueString, QString* timeString, int* yAxis) const;
|
||||
|
@ -19,20 +19,25 @@
|
||||
|
||||
#include "RiuWellLogPlot.h"
|
||||
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
|
||||
#include <QFocusEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMdiSubWindow>
|
||||
#include <QScrollBar>
|
||||
#include <QTimer>
|
||||
#include <QMenu>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -203,6 +208,27 @@ QSize RiuWellLogPlot::sizeHint() const
|
||||
return QSize(1,1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
QStringList commandIds;
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition());
|
||||
|
||||
commandIds << "RicShowPlotDataFeature";
|
||||
commandIds << "RicShowContributingWellsFromPlotFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
|
||||
if (menu.actions().size() > 0)
|
||||
{
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,6 +62,7 @@ protected:
|
||||
virtual void showEvent(QShowEvent *);
|
||||
virtual void changeEvent(QEvent *);
|
||||
virtual QSize sizeHint() const override;
|
||||
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
||||
|
||||
private:
|
||||
void updateScrollBar(double minDepth, double maxDepth);
|
||||
|
Loading…
Reference in New Issue
Block a user