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:
parent
18e0c8999e
commit
c68c0d0321
@ -40,7 +40,7 @@ RimColorLegendItem::RimColorLegendItem()
|
||||
CAF_PDM_InitField( &m_categoryName, "CategoryName", QString( "" ), "Category Name", "", "", "" );
|
||||
|
||||
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.xmlCapability()->disableIO();
|
||||
|
||||
@ -133,7 +133,7 @@ caf::PdmFieldHandle* RimColorLegendItem::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// "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;
|
||||
}
|
||||
|
@ -49,15 +49,14 @@ public:
|
||||
const QString& categoryName() const;
|
||||
int categoryValue() const;
|
||||
|
||||
QString itemName() const;
|
||||
|
||||
public:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) override;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
QString extractColorItemName() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
caf::PdmField<int> m_categoryValue;
|
||||
|
@ -696,8 +696,7 @@ void RimRegularLegendConfig::updateCategoryItems()
|
||||
for ( auto item : m_colorLegend->colorLegendItems() )
|
||||
{
|
||||
cvf::Color3ub ubColor( item->color() );
|
||||
QString categoryName = item->categoryName() + QString( " [%1]" ).arg( item->categoryValue() );
|
||||
categories.push_back( std::make_tuple( categoryName, item->categoryValue(), ubColor ) );
|
||||
categories.push_back( std::make_tuple( item->itemName(), item->categoryValue(), ubColor ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user