mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added updateUiIconFromState() in cafPdmUiItem to create disabled icons based on object state
Use updateUiIconFromState() from collection objects p4#: 21459
This commit is contained in:
@@ -267,5 +267,30 @@ PdmUiItem::~PdmUiItem()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiItem::updateUiIconFromState(bool active)
|
||||
{
|
||||
// Reset dynamic icon
|
||||
this->setUiIcon(QIcon());
|
||||
// Get static one
|
||||
QIcon icon = this->uiIcon();
|
||||
|
||||
// Get a pixmap, and modify it
|
||||
|
||||
QPixmap icPixmap;
|
||||
icPixmap = icon.pixmap(16, 16, QIcon::Normal);
|
||||
|
||||
if (!active)
|
||||
{
|
||||
QIcon temp(icPixmap);
|
||||
icPixmap = temp.pixmap(16, 16, QIcon::Disabled);
|
||||
}
|
||||
|
||||
QIcon newIcon(icPixmap);
|
||||
this->setUiIcon(newIcon);
|
||||
}
|
||||
|
||||
} //End of namespace caf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user