mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Better fix for legend and title in sub plots and summary dialog
This commit is contained in:
parent
377274cdec
commit
9391453c2c
@ -1646,7 +1646,7 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
{
|
||||
QString plotTitle = description();
|
||||
m_plotWidget->setPlotTitle( plotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
@ -192,4 +192,5 @@ void RimAnalysisPlotCollection::insertPlot( RimAnalysisPlot* analysisPlot, size_
|
||||
void RimAnalysisPlotCollection::removePlot( RimAnalysisPlot* analysisPlot )
|
||||
{
|
||||
m_analysisPlots.removeChildObject( analysisPlot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
@ -176,6 +176,8 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
|
||||
m_legendConfig->setColorLegend(
|
||||
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::CORRELATION ) );
|
||||
|
||||
setLegendsVisible( false );
|
||||
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_selectMultipleVectors = true;
|
||||
}
|
||||
@ -661,7 +663,7 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
|
@ -89,6 +89,7 @@ RimCorrelationPlot::RimCorrelationPlot()
|
||||
m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_selectedParametersList.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
|
||||
setLegendsVisible( false );
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -296,7 +297,7 @@ void RimCorrelationPlot::updatePlotTitle()
|
||||
.arg( timeStepString() );
|
||||
}
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
|
||||
|
@ -192,6 +192,7 @@ void RimCorrelationPlotCollection::insertPlot( RimAbstractCorrelationPlot* plot,
|
||||
void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* plot )
|
||||
{
|
||||
m_correlationPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -84,7 +84,7 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
|
||||
m_correlationPlot->setLegendsVisible( false );
|
||||
|
||||
m_parameterResultCrossPlot = new RimParameterResultCrossPlot;
|
||||
m_parameterResultCrossPlot->setLegendsVisible( false );
|
||||
m_parameterResultCrossPlot->setLegendsVisible( true );
|
||||
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
|
@ -166,10 +166,13 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate()
|
||||
if ( m_plotWidget && m_analyserOfSelectedCurveDefs )
|
||||
{
|
||||
createPoints();
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
m_plotWidget->updateLegend();
|
||||
if ( m_showPlotLegends && !isSubPlot() )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
m_plotWidget->updateLegend();
|
||||
}
|
||||
|
||||
this->updateAxes();
|
||||
this->updatePlotTitle();
|
||||
@ -307,6 +310,6 @@ void RimParameterResultCrossPlot::updatePlotTitle()
|
||||
.arg( timeStepString() );
|
||||
}
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
|
||||
{
|
||||
QString plotTitle = this->createAutoName();
|
||||
m_plotWidget->setPlotTitle( plotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
|
@ -83,4 +83,5 @@ void RimGridCrossPlotCollection::insertPlot( RimGridCrossPlot* plot, size_t inde
|
||||
void RimGridCrossPlotCollection::removePlot( RimGridCrossPlot* plot )
|
||||
{
|
||||
m_gridCrossPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ void RimDepthTrackPlot::onPlotAdditionOrRemoval()
|
||||
calculateAvailableDepthRange();
|
||||
updateZoom();
|
||||
updateSubPlotNames();
|
||||
updateConnectedEditors();
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -183,14 +183,6 @@ void RimMultiPlot::setMultiPlotTitle( const QString& title )
|
||||
m_plotWindowTitle = title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::addPlot( RimPlot* plot )
|
||||
{
|
||||
insertPlot( plot, m_plots.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -206,8 +198,6 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
plot->setPlotTitleVisible( false );
|
||||
plot->updateAfterInsertingIntoMultiPlot();
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
@ -484,7 +474,7 @@ void RimMultiPlot::onPlotAdditionOrRemoval()
|
||||
updateSubPlotNames();
|
||||
updatePlotWindowTitle();
|
||||
applyPlotWindowTitleToWidgets();
|
||||
updateConnectedEditors();
|
||||
updateAllRequiredEditors();
|
||||
updateLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
@ -499,6 +489,17 @@ void RimMultiPlot::onPlotsReordered( const caf::SignalEmitter* emitter )
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
updateSubPlotNames();
|
||||
recreatePlotWidgets();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
@ -37,7 +38,7 @@
|
||||
|
||||
class RimPlot;
|
||||
|
||||
class RimMultiPlot : public RimPlotWindow
|
||||
class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection<RimPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -69,16 +70,15 @@ public:
|
||||
QString multiPlotTitle() const;
|
||||
void setMultiPlotTitle( const QString& title );
|
||||
|
||||
void addPlot( RimPlot* plot );
|
||||
void insertPlot( RimPlot* plot, size_t index );
|
||||
void removePlot( RimPlot* plot );
|
||||
void insertPlot( RimPlot* plot, size_t index ) override;
|
||||
void removePlot( RimPlot* plot ) override;
|
||||
void movePlotsToThis( const std::vector<RimPlot*>& plots, int insertAtPosition );
|
||||
|
||||
size_t plotCount() const;
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
RimPlot* plotByIndex( size_t index ) const;
|
||||
|
||||
std::vector<RimPlot*> plots() const;
|
||||
std::vector<RimPlot*> plots() const override;
|
||||
std::vector<RimPlot*> visiblePlots() const;
|
||||
|
||||
void updatePlotOrderFromGridWidget();
|
||||
@ -136,6 +136,8 @@ private:
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void onPlotAdditionOrRemoval();
|
||||
void onPlotsReordered( const caf::SignalEmitter* emitter );
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_showPlotWindowTitle;
|
||||
|
@ -140,9 +140,10 @@ void RimPlot::removeFromMdiAreaAndCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::updateAfterInsertingIntoMultiPlot()
|
||||
{
|
||||
updateLegend();
|
||||
updateAxes();
|
||||
updateLayout();
|
||||
loadDataAndUpdate();
|
||||
/* updateLegend();
|
||||
updateAxes();
|
||||
updateLayout(); */
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -281,3 +282,13 @@ void RimPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Is this inside another plot window?
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlot::isSubPlot() const
|
||||
{
|
||||
RimPlotWindow* parentPlotWindow = nullptr;
|
||||
firstAncestorOfType( parentPlotWindow );
|
||||
return parentPlotWindow != nullptr;
|
||||
}
|
||||
|
@ -91,6 +91,8 @@ public:
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
bool isSubPlot() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
@ -223,8 +223,8 @@ void RimPltPlotCollection::addPlot( RimWellPltPlot* newPlot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPltPlotCollection::removePlot( RimWellPltPlot* plot )
|
||||
{
|
||||
size_t index = m_pltPlots.index( plot );
|
||||
if ( index < m_pltPlots.size() ) m_pltPlots.erase( index );
|
||||
m_pltPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -223,8 +223,8 @@ void RimRftPlotCollection::addPlot( RimWellRftPlot* newPlot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRftPlotCollection::removePlot( RimWellRftPlot* plot )
|
||||
{
|
||||
size_t index = m_rftPlots.index( plot );
|
||||
if ( index < m_rftPlots.size() ) m_rftPlots.erase( index );
|
||||
m_rftPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -93,6 +93,7 @@ void RimViewWindow::loadDataAndUpdate()
|
||||
{
|
||||
assignIdIfNecessary();
|
||||
onLoadDataAndUpdate();
|
||||
updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -108,6 +108,7 @@ void RimSummaryCrossPlotCollection::insertPlot( RimSummaryPlot* plot, size_t ind
|
||||
void RimSummaryCrossPlotCollection::removePlot( RimSummaryPlot* plot )
|
||||
{
|
||||
m_summaryCrossPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -588,7 +588,7 @@ void RimSummaryPlot::updatePlotTitle()
|
||||
{
|
||||
QString plotTitle = description();
|
||||
m_plotWidget->setPlotTitle( plotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
@ -656,7 +656,7 @@ void RimSummaryPlot::updateLegend()
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setLegendVisible( m_showPlotLegends );
|
||||
m_plotWidget->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() );
|
||||
}
|
||||
|
||||
reattachAllCurves();
|
||||
@ -1559,7 +1559,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setLegendVisible( m_showPlotLegends );
|
||||
m_plotWidget->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
m_plotWidget->updateLegend();
|
||||
}
|
||||
|
@ -145,4 +145,5 @@ void RimSummaryPlotCollection::insertPlot( RimSummaryPlot* summaryPlot, size_t i
|
||||
void RimSummaryPlotCollection::removePlot( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
m_summaryPlots.removeChildObject( summaryPlot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
@ -199,6 +199,10 @@ Qt::DropActions RiuDragDrop::supportedDropActions() const
|
||||
{
|
||||
return Qt::CopyAction;
|
||||
}
|
||||
else if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
|
||||
{
|
||||
// return Qt::CopyAction;
|
||||
}
|
||||
|
||||
return Qt::MoveAction;
|
||||
}
|
||||
|
@ -191,11 +191,9 @@ void RiuMultiPlotBook::removePlot( RiuQwtPlotWidget* plotWidget )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotBook::removeAllPlots()
|
||||
{
|
||||
auto plotWidgets = m_plotWidgets;
|
||||
for ( RiuQwtPlotWidget* plotWidget : plotWidgets )
|
||||
{
|
||||
removePlot( plotWidget );
|
||||
}
|
||||
deleteAllPages();
|
||||
m_plotWidgets.clear();
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -483,6 +481,7 @@ QList<QPointer<RiuQwtPlotWidget>> RiuMultiPlotBook::visiblePlotWidgets() const
|
||||
QList<QPointer<RiuQwtPlotWidget>> plotWidgets;
|
||||
for ( QPointer<RiuQwtPlotWidget> plotWidget : m_plotWidgets )
|
||||
{
|
||||
CAF_ASSERT( plotWidget );
|
||||
if ( plotWidget->isChecked() )
|
||||
{
|
||||
plotWidgets.push_back( plotWidget );
|
||||
@ -534,6 +533,7 @@ void RiuMultiPlotBook::createPages()
|
||||
row = 0;
|
||||
column = 0;
|
||||
}
|
||||
CAF_ASSERT( plotWidgets[visibleIndex] );
|
||||
page->addPlot( plotWidgets[visibleIndex] );
|
||||
page->performUpdate();
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void RiuMultiPlotPage::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index )
|
||||
m_subTitles.insert( static_cast<int>( index ), subTitle );
|
||||
|
||||
RiuQwtPlotLegend* legend = nullptr;
|
||||
if ( m_plotDefinition->legendsVisible() )
|
||||
if ( m_plotDefinition->legendsVisible() && plotWidget->plotDefinition()->legendsVisible() )
|
||||
{
|
||||
legend = new RiuQwtPlotLegend( this );
|
||||
int legendColumns = 1;
|
||||
|
@ -290,7 +290,7 @@ void RiuQwtPlotWidget::setLegendFontSize( int fontSize )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setLegendVisible( bool visible )
|
||||
void RiuQwtPlotWidget::setInternalLegendVisible( bool visible )
|
||||
{
|
||||
if ( visible )
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
void setPlotTitleFontSize( int titleFontSize );
|
||||
|
||||
void setLegendFontSize( int fontSize );
|
||||
void setLegendVisible( bool visible );
|
||||
void setInternalLegendVisible( bool visible );
|
||||
|
||||
QwtInterval axisRange( QwtPlot::Axis axis ) const;
|
||||
void setAxisRange( QwtPlot::Axis axis, double min, double max );
|
||||
|
@ -131,7 +131,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*=
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour( this );
|
||||
RiuQwtPlotTools::setDefaultAxes( this );
|
||||
|
||||
setLegendVisible( true );
|
||||
setInternalLegendVisible( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user