Add color icon to RimColorLegendItem in project tree.

This commit is contained in:
Kristian Bendiksen 2020-05-08 09:12:20 +02:00 committed by Magne Sjaastad
parent db384ea754
commit 368de8491e
2 changed files with 14 additions and 1 deletions

View File

@ -108,3 +108,15 @@ QString RimColorLegendItem::extractColorItemName() const
{
return QString( "%1" ).arg( m_categoryValue, 2, 10, QChar( '0' ) ) + " " + m_categoryName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimColorLegendItem::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{
QColor qcolor( m_color().rByte(), m_color().gByte(), m_color().bByte() );
caf::QIconProvider iconProvider = this->uiIconProvider();
iconProvider.setBackgroundColor( qcolor );
this->setUiIcon( iconProvider );
}

View File

@ -47,7 +47,8 @@ public:
int categoryValue() const;
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;
caf::PdmFieldHandle* userDescriptionField() override;
private: