mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#4990 Column and row span
This commit is contained in:
@@ -57,6 +57,9 @@ RimGridCrossPlot::RimGridCrossPlot()
|
|||||||
CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
|
CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
|
||||||
CAF_PDM_InitField( &m_showLegend_OBSOLETE, "ShowLegend", false, "Show Legend", "", "", "" );
|
CAF_PDM_InitField( &m_showLegend_OBSOLETE, "ShowLegend", false, "Show Legend", "", "", "" );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
|
||||||
m_nameConfig.uiCapability()->setUiTreeHidden( true );
|
m_nameConfig.uiCapability()->setUiTreeHidden( true );
|
||||||
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
@@ -387,6 +390,73 @@ void RimGridCrossPlot::onAxisSelected( int axis, bool toggle )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlot::addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
||||||
|
{
|
||||||
|
if ( m_plotWidget )
|
||||||
|
{
|
||||||
|
m_plotWidget->addOrUpdateDataSetLegend( dataSet );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
||||||
|
{
|
||||||
|
if ( m_plotWidget )
|
||||||
|
{
|
||||||
|
m_plotWidget->removeDataSetLegend( dataSet );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlot::removeFromMdiAreaAndCollection()
|
||||||
|
{
|
||||||
|
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType( crossPlotCollection );
|
||||||
|
if ( crossPlotCollection )
|
||||||
|
{
|
||||||
|
crossPlotCollection->removeGridCrossPlot( this );
|
||||||
|
this->revokeMdiWindowStatus();
|
||||||
|
crossPlotCollection->updateAllRequiredEditors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlot::updateAfterInsertingIntoGridPlotWindow()
|
||||||
|
{
|
||||||
|
if ( m_plotWidget )
|
||||||
|
{
|
||||||
|
m_plotWidget->setTitle( "" );
|
||||||
|
m_plotWidget->setInternalQwtLegendVisible( false );
|
||||||
|
}
|
||||||
|
updateAxes();
|
||||||
|
updateLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimGridCrossPlot::rowSpan() const
|
||||||
|
{
|
||||||
|
return static_cast<int>( m_rowSpan() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimGridCrossPlot::colSpan() const
|
||||||
|
{
|
||||||
|
return static_cast<int>( m_colSpan() );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -463,6 +533,11 @@ void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
|||||||
uiOrdering.add( &m_legendFontSize );
|
uiOrdering.add( &m_legendFontSize );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uiOrdering.add( &m_rowSpan );
|
||||||
|
uiOrdering.add( &m_colSpan );
|
||||||
|
}
|
||||||
|
|
||||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" );
|
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" );
|
||||||
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
|
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
|
||||||
@@ -497,8 +572,15 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
|||||||
{
|
{
|
||||||
updateLegend();
|
updateLegend();
|
||||||
}
|
}
|
||||||
|
else if ( changedField == &m_colSpan || changedField == &m_rowSpan )
|
||||||
|
{
|
||||||
|
updatePlotWindowLayout();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
onLoadDataAndUpdate();
|
onLoadDataAndUpdate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -1032,57 +1114,6 @@ void RimGridCrossPlot::updatePlotTitle()
|
|||||||
updateCurveNamesAndPlotTitle();
|
updateCurveNamesAndPlotTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGridCrossPlot::addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
|
||||||
{
|
|
||||||
if ( m_plotWidget )
|
|
||||||
{
|
|
||||||
m_plotWidget->addOrUpdateDataSetLegend( dataSet );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
|
||||||
{
|
|
||||||
if ( m_plotWidget )
|
|
||||||
{
|
|
||||||
m_plotWidget->removeDataSetLegend( dataSet );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGridCrossPlot::removeFromMdiAreaAndCollection()
|
|
||||||
{
|
|
||||||
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
|
|
||||||
this->firstAncestorOrThisOfType( crossPlotCollection );
|
|
||||||
if ( crossPlotCollection )
|
|
||||||
{
|
|
||||||
crossPlotCollection->removeGridCrossPlot( this );
|
|
||||||
this->revokeMdiWindowStatus();
|
|
||||||
crossPlotCollection->updateAllRequiredEditors();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGridCrossPlot::updateAfterInsertingIntoGridPlotWindow()
|
|
||||||
{
|
|
||||||
if ( m_plotWidget )
|
|
||||||
{
|
|
||||||
m_plotWidget->setTitle( "" );
|
|
||||||
m_plotWidget->setInternalQwtLegendVisible( false );
|
|
||||||
}
|
|
||||||
updateAxes();
|
|
||||||
updateLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Name Configuration
|
/// Name Configuration
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ public:
|
|||||||
void removeFromMdiAreaAndCollection() override;
|
void removeFromMdiAreaAndCollection() override;
|
||||||
void updateAfterInsertingIntoGridPlotWindow() override;
|
void updateAfterInsertingIntoGridPlotWindow() override;
|
||||||
|
|
||||||
|
int rowSpan() const override;
|
||||||
|
int colSpan() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||||
void deleteViewWidget() override;
|
void deleteViewWidget() override;
|
||||||
@@ -155,6 +158,9 @@ private:
|
|||||||
caf::PdmField<bool> m_showLegend_OBSOLETE;
|
caf::PdmField<bool> m_showLegend_OBSOLETE;
|
||||||
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
|
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
|
||||||
|
|
||||||
|
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_rowSpan;
|
||||||
|
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
|
||||||
|
|
||||||
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
|
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
|
||||||
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
|
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ int RimGridPlotWindow::columnCount() const
|
|||||||
{
|
{
|
||||||
if ( m_columnCountEnum() == COLUMNS_UNLIMITED )
|
if ( m_columnCountEnum() == COLUMNS_UNLIMITED )
|
||||||
{
|
{
|
||||||
return static_cast<int>( visiblePlots().size() );
|
std::numeric_limits<int>::max();
|
||||||
}
|
}
|
||||||
return static_cast<int>( m_columnCountEnum() );
|
return static_cast<int>( m_columnCountEnum() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,17 @@ void RimPlotInterface::WidthScaleFactorEnum::setUp()
|
|||||||
addItem( RimPlotInterface::EXTRA_WIDE, "EXTRA_WIDE_TRACK", "Extra wide" );
|
addItem( RimPlotInterface::EXTRA_WIDE, "EXTRA_WIDE_TRACK", "Extra wide" );
|
||||||
setDefault( RimPlotInterface::NORMAL );
|
setDefault( RimPlotInterface::NORMAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void RimPlotInterface::RowOrColSpanEnum::setUp()
|
||||||
|
{
|
||||||
|
addItem( RimPlotInterface::ONE, "ONE", "1" );
|
||||||
|
addItem( RimPlotInterface::TWO, "TWO", "2" );
|
||||||
|
addItem( RimPlotInterface::THREE, "THREE", "3" );
|
||||||
|
addItem( RimPlotInterface::FOUR, "FOUR", "4" );
|
||||||
|
setDefault( RimPlotInterface::ONE );
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace caf
|
} // namespace caf
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -45,3 +56,19 @@ QString RimPlotInterface::asciiDataForPlotExport() const
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotInterface::updatePlotWindowLayout()
|
||||||
|
{
|
||||||
|
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
|
||||||
|
CAF_ASSERT( thisPdm );
|
||||||
|
|
||||||
|
RimGridPlotWindow* plotWindow;
|
||||||
|
thisPdm->firstAncestorOrThisOfType( plotWindow );
|
||||||
|
if ( plotWindow )
|
||||||
|
{
|
||||||
|
plotWindow->updateLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,9 +41,17 @@ public:
|
|||||||
WIDE = 7,
|
WIDE = 7,
|
||||||
EXTRA_WIDE = 10
|
EXTRA_WIDE = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef caf::AppEnum<WidthScaleFactor> WidthScaleFactorEnum;
|
typedef caf::AppEnum<WidthScaleFactor> WidthScaleFactorEnum;
|
||||||
|
|
||||||
|
enum RowOrColSpan
|
||||||
|
{
|
||||||
|
ONE = 1,
|
||||||
|
TWO = 2,
|
||||||
|
THREE = 3,
|
||||||
|
FOUR = 4
|
||||||
|
};
|
||||||
|
typedef caf::AppEnum<RowOrColSpan> RowOrColSpanEnum;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RimPlotInterface() = default;
|
RimPlotInterface() = default;
|
||||||
virtual ~RimPlotInterface() = default;
|
virtual ~RimPlotInterface() = default;
|
||||||
@@ -99,6 +107,6 @@ public:
|
|||||||
virtual void updateAfterInsertingIntoGridPlotWindow() {}
|
virtual void updateAfterInsertingIntoGridPlotWindow() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void updatePlotWindowLayout() {}
|
void updatePlotWindowLayout();
|
||||||
virtual void onWidthScaleFactorChange() {}
|
virtual void onWidthScaleFactorChange() {}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -882,19 +882,6 @@ void RimWellLogTrack::updateZoomFromQwt()
|
|||||||
m_visibleYRangeMax = depthInterval.maxValue();
|
m_visibleYRangeMax = depthInterval.maxValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogTrack::updatePlotWindowLayout()
|
|
||||||
{
|
|
||||||
RimGridPlotWindow* plotWindow;
|
|
||||||
this->firstAncestorOrThisOfType( plotWindow );
|
|
||||||
if ( plotWindow )
|
|
||||||
{
|
|
||||||
plotWindow->updateLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -198,8 +198,6 @@ public:
|
|||||||
int fontSize,
|
int fontSize,
|
||||||
bool forceChange = false ) override;
|
bool forceChange = false ) override;
|
||||||
|
|
||||||
void updatePlotWindowLayout() override;
|
|
||||||
|
|
||||||
void onAxisSelected( int axis, bool toggle ) override;
|
void onAxisSelected( int axis, bool toggle ) override;
|
||||||
|
|
||||||
void updateAxes() override;
|
void updateAxes() override;
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ RimSummaryPlot::RimSummaryPlot()
|
|||||||
|
|
||||||
CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
|
CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_curveFilters_OBSOLETE, "SummaryCurveFilters", "", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_curveFilters_OBSOLETE, "SummaryCurveFilters", "", "", "", "" );
|
||||||
m_curveFilters_OBSOLETE.uiCapability()->setUiTreeHidden( true );
|
m_curveFilters_OBSOLETE.uiCapability()->setUiTreeHidden( true );
|
||||||
|
|
||||||
@@ -1343,6 +1346,11 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( changedField == &m_rowSpan || changedField == &m_colSpan )
|
||||||
|
{
|
||||||
|
updatePlotWindowLayout();
|
||||||
|
}
|
||||||
|
|
||||||
if ( changedField == &m_normalizeCurveYValues )
|
if ( changedField == &m_normalizeCurveYValues )
|
||||||
{
|
{
|
||||||
this->loadDataAndUpdate();
|
this->loadDataAndUpdate();
|
||||||
@@ -1555,6 +1563,22 @@ void RimSummaryPlot::updateAfterInsertingIntoGridPlotWindow()
|
|||||||
updateAxes();
|
updateAxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimSummaryPlot::rowSpan() const
|
||||||
|
{
|
||||||
|
return static_cast<int>( m_rowSpan() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimSummaryPlot::colSpan() const
|
||||||
|
{
|
||||||
|
return static_cast<int>( m_colSpan() );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1654,6 +1678,8 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
|||||||
{
|
{
|
||||||
mainOptions->add( &m_useAutoPlotTitle );
|
mainOptions->add( &m_useAutoPlotTitle );
|
||||||
mainOptions->add( &m_description );
|
mainOptions->add( &m_description );
|
||||||
|
mainOptions->add( &m_rowSpan );
|
||||||
|
mainOptions->add( &m_colSpan );
|
||||||
}
|
}
|
||||||
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle );
|
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle );
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,9 @@ public:
|
|||||||
void removeFromMdiAreaAndCollection() override;
|
void removeFromMdiAreaAndCollection() override;
|
||||||
void updateAfterInsertingIntoGridPlotWindow() override;
|
void updateAfterInsertingIntoGridPlotWindow() override;
|
||||||
|
|
||||||
|
int rowSpan() const override;
|
||||||
|
int colSpan() const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// RimViewWindow overrides
|
// RimViewWindow overrides
|
||||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||||
@@ -226,6 +229,9 @@ private:
|
|||||||
|
|
||||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||||
|
|
||||||
|
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_rowSpan;
|
||||||
|
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
||||||
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
||||||
caf::PdmChildField<RimEnsembleCurveSetCollection*> m_ensembleCurveSetCollection;
|
caf::PdmChildField<RimEnsembleCurveSetCollection*> m_ensembleCurveSetCollection;
|
||||||
|
|||||||
@@ -573,6 +573,7 @@ void RiuGridPlotWindow::reinsertPlotWidgets()
|
|||||||
{
|
{
|
||||||
m_plotWidgets[tIdx]->hide();
|
m_plotWidgets[tIdx]->hide();
|
||||||
m_legends[tIdx]->hide();
|
m_legends[tIdx]->hide();
|
||||||
|
m_subTitles[tIdx]->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QPointer<QLabel>> subTitles = this->visibleTitles();
|
QList<QPointer<QLabel>> subTitles = this->visibleTitles();
|
||||||
@@ -591,14 +592,21 @@ void RiuGridPlotWindow::reinsertPlotWidgets()
|
|||||||
|
|
||||||
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
|
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
int column = 0;
|
||||||
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
|
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
|
||||||
{
|
{
|
||||||
int row = visibleIndex / rowAndColumnCount.second;
|
std::tie( row, column ) = findAvailableRowAndColumn( row,
|
||||||
int column = visibleIndex % rowAndColumnCount.second;
|
column,
|
||||||
|
rowAndColumnCount.first,
|
||||||
|
rowAndColumnCount.second );
|
||||||
|
|
||||||
m_gridLayout->addWidget( subTitles[visibleIndex], 3 * row, column );
|
int colSpan = plotWidgets[visibleIndex]->plotDefinition()->colSpan();
|
||||||
m_gridLayout->addWidget( legends[visibleIndex], 3 * row + 1, column );
|
int rowSpan = plotWidgets[visibleIndex]->plotDefinition()->rowSpan();
|
||||||
m_gridLayout->addWidget( plotWidgets[visibleIndex], 3 * row + 2, column );
|
|
||||||
|
m_gridLayout->addWidget( subTitles[visibleIndex], 3 * row, column, 1, colSpan );
|
||||||
|
m_gridLayout->addWidget( legends[visibleIndex], 3 * row + 1, column, 1, colSpan );
|
||||||
|
m_gridLayout->addWidget( plotWidgets[visibleIndex], 3 * row + 2, column, 1 + ( rowSpan - 1 ) * 3, colSpan );
|
||||||
|
|
||||||
subTitles[visibleIndex]->setVisible( m_plotDefinition->showPlotTitles() );
|
subTitles[visibleIndex]->setVisible( m_plotDefinition->showPlotTitles() );
|
||||||
|
|
||||||
@@ -627,15 +635,24 @@ void RiuGridPlotWindow::reinsertPlotWidgets()
|
|||||||
|
|
||||||
plotWidgets[visibleIndex]->show();
|
plotWidgets[visibleIndex]->show();
|
||||||
|
|
||||||
|
// Set basic row and column stretches
|
||||||
|
for ( int r = row; r < row + rowSpan; ++r )
|
||||||
|
{
|
||||||
|
m_gridLayout->setRowStretch( 3 * r + 2, 1 );
|
||||||
|
}
|
||||||
|
for ( int c = column; c < column + colSpan; ++c )
|
||||||
|
{
|
||||||
|
m_gridLayout->setColumnStretch( c, std::max( 1, m_gridLayout->columnStretch( c ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set column stretches for main widget column based on width scale factor
|
||||||
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
|
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
|
||||||
if ( showYAxis( row, column ) )
|
if ( showYAxis( row, column ) )
|
||||||
{
|
{
|
||||||
widthScaleFactor += 1; // Give it a bit extra room due to axis
|
widthScaleFactor += 1; // Give it a bit extra room due to axis
|
||||||
}
|
}
|
||||||
m_gridLayout->setColumnStretch( column,
|
|
||||||
std::max( m_gridLayout->columnStretch( column ),
|
m_gridLayout->setColumnStretch( column, std::max( m_gridLayout->columnStretch( column ), widthScaleFactor ) );
|
||||||
plotWidgets[visibleIndex]->widthScaleFactor() ) );
|
|
||||||
m_gridLayout->setRowStretch( 3 * row + 2, 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -758,3 +775,28 @@ QList<QPointer<QLabel>> RiuGridPlotWindow::visibleTitles() const
|
|||||||
}
|
}
|
||||||
return subTitles;
|
return subTitles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::pair<int, int> RiuGridPlotWindow::findAvailableRowAndColumn( int startRow,
|
||||||
|
int startColumn,
|
||||||
|
int expectedRows,
|
||||||
|
int expectedColumns ) const
|
||||||
|
{
|
||||||
|
int availableRow = startRow;
|
||||||
|
int availableColumn = startColumn;
|
||||||
|
while ( true )
|
||||||
|
{
|
||||||
|
for ( ; availableColumn < expectedColumns; ++availableColumn )
|
||||||
|
{
|
||||||
|
if ( m_gridLayout->itemAtPosition( 3 * availableRow, availableColumn ) == nullptr )
|
||||||
|
{
|
||||||
|
return std::make_pair( availableRow, availableColumn );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
availableColumn = 0;
|
||||||
|
availableRow++;
|
||||||
|
}
|
||||||
|
return std::make_pair( availableRow, availableColumn );
|
||||||
|
}
|
||||||
|
|||||||
@@ -109,6 +109,9 @@ protected:
|
|||||||
QList<QPointer<RiuQwtPlotLegend>> visibleLegends() const;
|
QList<QPointer<RiuQwtPlotLegend>> visibleLegends() const;
|
||||||
QList<QPointer<QLabel>> visibleTitles() const;
|
QList<QPointer<QLabel>> visibleTitles() const;
|
||||||
|
|
||||||
|
std::pair<int, int>
|
||||||
|
findAvailableRowAndColumn( int startRow, int startColumn, int expectedRows, int expectedColumns ) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
virtual void performUpdate();
|
virtual void performUpdate();
|
||||||
|
|
||||||
|
|||||||
@@ -95,12 +95,13 @@ void RiuWellLogPlot::reinsertScrollbar()
|
|||||||
{
|
{
|
||||||
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
|
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
|
||||||
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
|
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
|
||||||
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
|
int rowCount = this->m_gridLayout->rowCount();
|
||||||
|
int colCount = this->m_gridLayout->columnCount();
|
||||||
|
|
||||||
m_trackScrollBar->setVisible( !plotWidgets.empty() );
|
m_trackScrollBar->setVisible( !plotWidgets.empty() );
|
||||||
|
|
||||||
m_gridLayout->addLayout( m_trackScrollBarLayout, 2, rowAndColumnCount.second, rowAndColumnCount.first * 2 - 1, 1 );
|
m_gridLayout->addLayout( m_trackScrollBarLayout, 2, colCount, rowCount * 2 - 1, 1 );
|
||||||
m_gridLayout->setColumnStretch( rowAndColumnCount.second, 0 );
|
m_gridLayout->setColumnStretch( colCount, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user