Further refactoring

This commit is contained in:
Gaute Lindkvist
2019-11-15 13:35:39 +01:00
parent 3dd4cb505b
commit 85d683634c
34 changed files with 283 additions and 237 deletions

View File

@@ -29,7 +29,7 @@
#include "RimEclipseResultCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimPlot.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
@@ -186,7 +186,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimMultiPlot*>( uiItem ) )
else if ( dynamic_cast<RimMultiPlotWindow*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
{
@@ -304,7 +304,7 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in
return handleWellLogPlotTrackDrop( action, draggedObjects, wellLogPlotTrack, row );
}
RimMultiPlot* multiPlot;
RimMultiPlotWindow* multiPlot;
dropTarget->firstAncestorOrThisOfType( multiPlot );
if ( multiPlot )
{
@@ -456,7 +456,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop( Qt::DropAction action,
//--------------------------------------------------------------------------------------------------
bool RiuDragDrop::handleMultiPlotDrop( Qt::DropAction action,
caf::PdmObjectGroup& draggedObjects,
RimMultiPlot* multiPlot,
RimMultiPlotWindow* multiPlot,
int insertAtPosition )
{
std::vector<RimPlot*> plots = RiuTypedPdmObjects<RimPlot>::typedObjectsFromGroup( draggedObjects );

View File

@@ -29,7 +29,7 @@ namespace caf
class PdmObjectHandle;
}
class RimMultiPlot;
class RimMultiPlotWindow;
class RimIdenticalGridCaseGroup;
class RimSummaryCaseCollection;
class RimSummaryCaseMainCollection;
@@ -67,7 +67,7 @@ private:
int insertAtPosition );
bool handleMultiPlotDrop( Qt::DropAction action,
caf::PdmObjectGroup& objectGroup,
RimMultiPlot* multiPlot,
RimMultiPlotWindow* multiPlot,
int insertAtPosition );
bool handleWellLogPlotCurveDrop( Qt::DropAction action,
caf::PdmObjectGroup& objectGroup,

View File

@@ -26,7 +26,7 @@
#include "WellLogCommands/RicWellLogPlotTrackFeatureImpl.h"
#include "RimContextCommandBuilder.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotWindow.h"
#include "RimWellLogTrack.h"
#include "RiuMainWindow.h"
@@ -57,7 +57,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlot* plotDefinition, QWidget* parent )
RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent )
: QWidget( parent )
{
Q_ASSERT( plotDefinition );
@@ -100,7 +100,7 @@ RiuMultiPlotWindow::RiuMultiPlotWindow( RimMultiPlot* plotDefinition, QWidget* p
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops( true );
setAcceptDrops( m_plotDefinition->acceptDrops() );
RiaApplication* app = RiaApplication::instance();
int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum( app->preferences()->defaultPlotFontSize() );
@@ -117,7 +117,7 @@ RiuMultiPlotWindow::~RiuMultiPlotWindow() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMultiPlot* RiuMultiPlotWindow::ownerPlotDefinition()
RimMultiPlotWindow* RiuMultiPlotWindow::ownerPlotDefinition()
{
return m_plotDefinition;
}
@@ -566,7 +566,7 @@ void RiuMultiPlotWindow::reinsertPlotWidgets()
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
if ( plotWidgets.empty() )
if ( plotWidgets.empty() && acceptDrops() )
{
m_gridLayout->addWidget( m_dropTargetPlaceHolder, 0, 0 );
m_gridLayout->setRowStretch( 0, 1 );

View File

@@ -35,7 +35,7 @@
#include <map>
class RiaPlotWindowRedrawScheduler;
class RimMultiPlot;
class RimMultiPlotWindow;
class RiuQwtPlotLegend;
class RiuQwtPlotWidget;
@@ -53,11 +53,11 @@ class RiuMultiPlotWindow : public QWidget, public RiuInterfaceToViewWindow, publ
Q_OBJECT
public:
RiuMultiPlotWindow( RimMultiPlot* plotDefinition, QWidget* parent = nullptr );
RiuMultiPlotWindow( RimMultiPlotWindow* plotDefinition, QWidget* parent = nullptr );
~RiuMultiPlotWindow() override;
RimMultiPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
RimMultiPlotWindow* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
void addPlot( RiuQwtPlotWidget* plotWidget );
void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index );
@@ -113,17 +113,17 @@ private slots:
virtual void performUpdate();
protected:
QPointer<QVBoxLayout> m_layout;
QPointer<QHBoxLayout> m_plotLayout;
QPointer<QFrame> m_plotWidgetFrame;
QPointer<QGridLayout> m_gridLayout;
QPointer<QLabel> m_plotTitle;
QList<int> m_legendColumns;
QList<QPointer<QLabel>> m_subTitles;
QList<QPointer<RiuQwtPlotLegend>> m_legends;
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
caf::PdmPointer<RimMultiPlot> m_plotDefinition;
QPointer<QLabel> m_dropTargetPlaceHolder;
QPointer<QVBoxLayout> m_layout;
QPointer<QHBoxLayout> m_plotLayout;
QPointer<QFrame> m_plotWidgetFrame;
QPointer<QGridLayout> m_gridLayout;
QPointer<QLabel> m_plotTitle;
QList<int> m_legendColumns;
QList<QPointer<QLabel>> m_subTitles;
QList<QPointer<RiuQwtPlotLegend>> m_legends;
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
caf::PdmPointer<RimMultiPlotWindow> m_plotDefinition;
QPointer<QLabel> m_dropTargetPlaceHolder;
RiuWidgetStyleSheet m_dropTargetStyleSheet;

View File

@@ -571,7 +571,7 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar()
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateMultiPlotToolBar()
{
RimMultiPlot* plotWindow = dynamic_cast<RimMultiPlot*>( m_activePlotViewWindow.p() );
RimMultiPlotWindow* plotWindow = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
if ( plotWindow )
{
std::vector<caf::PdmFieldHandle*> toolBarFields = {plotWindow->columnCountField()};
@@ -592,8 +592,8 @@ void RiuPlotMainWindow::updateMultiPlotToolBar()
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi )
{
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
RimMultiPlot* multiPlot = dynamic_cast<RimMultiPlot*>( m_activePlotViewWindow.p() );
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>( m_activePlotViewWindow.p() );
RimMultiPlotWindow* multiPlot = dynamic_cast<RimMultiPlotWindow*>( m_activePlotViewWindow.p() );
if ( multiPlot )
{
summaryPlot = caf::SelectionManager::instance()->selectedItemOfType<RimSummaryPlot>();