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:
@@ -38,15 +38,12 @@ CAF_CMD_SOURCE_INIT( RicInsertColorLegendItemFeature, "RicInsertColorLegendItemF
|
|||||||
bool RicInsertColorLegendItemFeature::isCommandEnabled() const
|
bool RicInsertColorLegendItemFeature::isCommandEnabled() const
|
||||||
{
|
{
|
||||||
RimColorLegend* legend = selectedColorLegend();
|
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 !colorLegendCollection->isStandardColorLegend( legend );
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -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();
|
||||||
~RimColorLegendItem() override;
|
~RimColorLegendItem() override;
|
||||||
|
|
||||||
|
void setCategoryFieldsHidden( bool hidden );
|
||||||
|
|
||||||
void setValues( const QString& categoryName, int categoryValue, const cvf::Color3f& color );
|
void setValues( const QString& categoryName, int categoryValue, const cvf::Color3f& color );
|
||||||
void setCategoryValue( int categoryValue );
|
void setCategoryValue( int categoryValue );
|
||||||
void setReadOnly( bool doReadOnly );
|
void setReadOnly( bool doReadOnly );
|
||||||
|
|||||||
@@ -250,6 +250,8 @@ void RimCustomVfpPlot::createDefaultColors()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_legendConfig->setColorLegend( m_colorLegend );
|
m_legendConfig->setColorLegend( m_colorLegend );
|
||||||
|
|
||||||
|
setColorItemCategoryHidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -712,6 +714,14 @@ void RimCustomVfpPlot::onLoadDataAndUpdate()
|
|||||||
m_plotWidget->scheduleReplot();
|
m_plotWidget->scheduleReplot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCustomVfpPlot::initAfterRead()
|
||||||
|
{
|
||||||
|
setColorItemCategoryHidden();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1127,6 +1137,20 @@ void RimCustomVfpPlot::legendColorsChanged( const caf::SignalEmitter* emitter )
|
|||||||
onLoadDataAndUpdate();
|
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 onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& updatedObjects ) override;
|
||||||
void deleteViewWidget() override;
|
void deleteViewWidget() override;
|
||||||
void onLoadDataAndUpdate() override;
|
void onLoadDataAndUpdate() override;
|
||||||
|
void initAfterRead() override;
|
||||||
|
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
|
|
||||||
@@ -180,6 +181,7 @@ private:
|
|||||||
|
|
||||||
caf::ColorTable curveColors() const;
|
caf::ColorTable curveColors() const;
|
||||||
void legendColorsChanged( const caf::SignalEmitter* emitter );
|
void legendColorsChanged( const caf::SignalEmitter* emitter );
|
||||||
|
void setColorItemCategoryHidden();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<QString> m_plotTitle;
|
caf::PdmField<QString> m_plotTitle;
|
||||||
|
|||||||
Reference in New Issue
Block a user