Allow hiding of category name in color legend item

This commit is contained in:
Magne Sjaastad
2024-06-20 08:34:05 +02:00
parent 736bfd9a96
commit 3164b39225
5 changed files with 41 additions and 7 deletions

View File

@@ -250,6 +250,8 @@ void RimCustomVfpPlot::createDefaultColors()
}
m_legendConfig->setColorLegend( m_colorLegend );
setColorItemCategoryHidden();
}
//--------------------------------------------------------------------------------------------------
@@ -712,6 +714,14 @@ void RimCustomVfpPlot::onLoadDataAndUpdate()
m_plotWidget->scheduleReplot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCustomVfpPlot::initAfterRead()
{
setColorItemCategoryHidden();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1127,6 +1137,20 @@ void RimCustomVfpPlot::legendColorsChanged( const caf::SignalEmitter* emitter )
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCustomVfpPlot::setColorItemCategoryHidden()
{
if ( m_colorLegend )
{
for ( auto item : m_colorLegend->colorLegendItems() )
{
item->setCategoryFieldsHidden( true );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -96,6 +96,7 @@ private:
void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& updatedObjects ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
caf::PdmFieldHandle* userDescriptionField() override;
@@ -180,6 +181,7 @@ private:
caf::ColorTable curveColors() const;
void legendColorsChanged( const caf::SignalEmitter* emitter );
void setColorItemCategoryHidden();
private:
caf::PdmField<QString> m_plotTitle;