mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Allow hiding of category name in color legend item
This commit is contained in:
parent
736bfd9a96
commit
3164b39225
@ -38,15 +38,12 @@ CAF_CMD_SOURCE_INIT( RicInsertColorLegendItemFeature, "RicInsertColorLegendItemF
|
||||
bool RicInsertColorLegendItemFeature::isCommandEnabled() const
|
||||
{
|
||||
RimColorLegend* legend = selectedColorLegend();
|
||||
if ( !legend ) return false;
|
||||
|
||||
if ( legend )
|
||||
{
|
||||
RimColorLegendCollection* colorLegendCollection = legend->firstAncestorOrThisOfType<RimColorLegendCollection>();
|
||||
RimColorLegendCollection* colorLegendCollection = legend->firstAncestorOrThisOfType<RimColorLegendCollection>();
|
||||
if ( !colorLegendCollection ) return true;
|
||||
|
||||
if ( colorLegendCollection && !colorLegendCollection->isStandardColorLegend( legend ) ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !colorLegendCollection->isStandardColorLegend( legend );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -58,6 +58,15 @@ RimColorLegendItem::~RimColorLegendItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegendItem::setCategoryFieldsHidden( bool hidden )
|
||||
{
|
||||
m_categoryName.uiCapability()->setUiHidden( hidden );
|
||||
m_categoryValue.uiCapability()->setUiHidden( hidden );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
RimColorLegendItem();
|
||||
~RimColorLegendItem() override;
|
||||
|
||||
void setCategoryFieldsHidden( bool hidden );
|
||||
|
||||
void setValues( const QString& categoryName, int categoryValue, const cvf::Color3f& color );
|
||||
void setCategoryValue( int categoryValue );
|
||||
void setReadOnly( bool doReadOnly );
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user