mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6164 Color Legend : Adjust UI names
This commit is contained in:
@@ -40,7 +40,7 @@ RimColorLegendItem::RimColorLegendItem()
|
|||||||
CAF_PDM_InitField( &m_categoryName, "CategoryName", QString( "" ), "Category Name", "", "", "" );
|
CAF_PDM_InitField( &m_categoryName, "CategoryName", QString( "" ), "Category Name", "", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" );
|
||||||
m_nameProxy.registerGetMethod( this, &RimColorLegendItem::extractColorItemName );
|
m_nameProxy.registerGetMethod( this, &RimColorLegendItem::itemName );
|
||||||
m_nameProxy.uiCapability()->setUiHidden( true );
|
m_nameProxy.uiCapability()->setUiHidden( true );
|
||||||
m_nameProxy.xmlCapability()->disableIO();
|
m_nameProxy.xmlCapability()->disableIO();
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ caf::PdmFieldHandle* RimColorLegendItem::userDescriptionField()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// "stringify" category value and name; category value with leading zeros presupposing max 2 digits
|
/// "stringify" category value and name; category value with leading zeros presupposing max 2 digits
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimColorLegendItem::extractColorItemName() const
|
QString RimColorLegendItem::itemName() const
|
||||||
{
|
{
|
||||||
return QString( "%1" ).arg( m_categoryValue, 2, 10, QChar( '0' ) ) + " " + m_categoryName;
|
return QString( "%1" ).arg( m_categoryValue, 2, 10, QChar( '0' ) ) + " " + m_categoryName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,15 +49,14 @@ public:
|
|||||||
const QString& categoryName() const;
|
const QString& categoryName() const;
|
||||||
int categoryValue() const;
|
int categoryValue() const;
|
||||||
|
|
||||||
|
QString itemName() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) override;
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) override;
|
||||||
|
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
|
|
||||||
private:
|
|
||||||
QString extractColorItemName() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<cvf::Color3f> m_color;
|
caf::PdmField<cvf::Color3f> m_color;
|
||||||
caf::PdmField<int> m_categoryValue;
|
caf::PdmField<int> m_categoryValue;
|
||||||
|
|||||||
@@ -696,8 +696,7 @@ void RimRegularLegendConfig::updateCategoryItems()
|
|||||||
for ( auto item : m_colorLegend->colorLegendItems() )
|
for ( auto item : m_colorLegend->colorLegendItems() )
|
||||||
{
|
{
|
||||||
cvf::Color3ub ubColor( item->color() );
|
cvf::Color3ub ubColor( item->color() );
|
||||||
QString categoryName = item->categoryName() + QString( " [%1]" ).arg( item->categoryValue() );
|
categories.push_back( std::make_tuple( item->itemName(), item->categoryValue(), ubColor ) );
|
||||||
categories.push_back( std::make_tuple( categoryName, item->categoryValue(), ubColor ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user