From 163b742ad0dcaef67794ed1a820bb0377d90ef83 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 27 Nov 2023 10:45:34 +0100 Subject: [PATCH] Remove drag/drop of individual summary curves Drag/drop of individual curves is unstable. Remove drag/drop, as arrow buttons can be used to change ordering of curves. --- .../Summary/RimSummaryPlot.cpp | 39 ------------------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 - .../UserInterface/RiuDragDrop.cpp | 38 +----------------- .../UserInterface/RiuDragDrop.h | 2 - 4 files changed, 2 insertions(+), 79 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index f8837fed73..43738e8358 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -420,45 +420,6 @@ void RimSummaryPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::moveCurvesToPlot( RimSummaryPlot* plot, const std::vector curves, int insertAtPosition ) -{ - CAF_ASSERT( plot ); - - std::set srcPlots; - - for ( auto curve : curves ) - { - auto srcPlot = curve->firstAncestorOrThisOfTypeAsserted(); - - srcPlot->removeCurve( curve ); - srcPlots.insert( srcPlot ); - } - - for ( auto srcPlot : srcPlots ) - { - srcPlot->updateConnectedEditors(); - srcPlot->loadDataAndUpdate(); - } - for ( size_t cIdx = 0; cIdx < curves.size(); ++cIdx ) - { - if ( insertAtPosition >= 0 ) - { - size_t position = (size_t)insertAtPosition + cIdx; - plot->insertCurve( curves[cIdx], position ); - } - else - { - plot->addCurveNoUpdate( curves[cIdx] ); - } - } - - plot->updateConnectedEditors(); - plot->updateStackedCurveData(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index f6e52613b6..a54133b8cf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -197,8 +197,6 @@ public: return 8; } - static void moveCurvesToPlot( RimSummaryPlot* plot, const std::vector curves, int insertAtPosition ); - std::vector curvesForStepping() const override; std::vector curveSets() const override; std::vector allCurves() const override; diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 4a99613920..ead07b0190 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -38,9 +38,6 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryCurve.h" -#include "RimSummaryCurveCollection.h" -#include "RimSummaryPlot.h" #include "RimSurface.h" #include "RimSurfaceCollection.h" #include "RimWellAllocationPlot.h" @@ -250,9 +247,8 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const } if ( dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || - dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || - dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || - dynamic_cast( uiItem ) || dynamic_cast( uiItem ) ) + dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || + dynamic_cast( uiItem ) || dynamic_cast( uiItem ) ) { itemflags |= Qt::ItemIsDragEnabled; } @@ -320,13 +316,6 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const } } } - else if ( dynamic_cast( uiItem ) || dynamic_cast( uiItem ) ) - { - if ( RiuTypedPdmObjects::containsTypedObjects( m_dragItems ) ) - { - itemflags |= Qt::ItemIsDropEnabled; - } - } else if ( dynamic_cast( uiItem ) ) { if ( RiuTypedPdmObjects::containsTypedObjects( m_dragItems ) ) @@ -416,12 +405,6 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in return handleWellLogPlotDrop( action, draggedObjects, wellLogPlot, row ); } - auto summaryPlot = dropTarget->firstAncestorOrThisOfType(); - if ( summaryPlot ) - { - return handleSummaryPlotDrop( action, draggedObjects, summaryPlot, row ); - } - auto multiPlot = dropTarget->firstAncestorOrThisOfType(); if ( multiPlot ) { @@ -585,23 +568,6 @@ bool RiuDragDrop::handleWellLogPlotDrop( Qt::DropAction action, return false; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiuDragDrop::handleSummaryPlotDrop( Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimSummaryPlot* summaryPlot, int insertAtPosition ) -{ - std::vector summaryCurves = RiuTypedPdmObjects::typedObjectsFromGroup( objectGroup ); - if ( !summaryCurves.empty() ) - { - if ( action == Qt::MoveAction ) - { - RimSummaryPlot::moveCurvesToPlot( summaryPlot, summaryCurves, insertAtPosition ); - return true; - } - } - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.h b/ApplicationLibCode/UserInterface/RiuDragDrop.h index dffca288cc..f6b5531e5b 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.h +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.h @@ -78,8 +78,6 @@ private: bool handleWellLogPlotDrop( Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot, int insertAtPosition ); - bool handleSummaryPlotDrop( Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimSummaryPlot* summaryPlot, int insertAtPosition ); - bool handleMultiPlotDrop( Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimMultiPlot* multiPlot, int insertAtPosition ); bool handleSummaryCaseCollectionDrop( Qt::DropAction action, caf::PdmObjectGroup& objectGroup,