Added updateUiIconFromState() in cafPdmUiItem to create disabled icons based on object state

Use updateUiIconFromState() from collection objects
p4#: 21459
This commit is contained in:
Magne Sjaastad
2013-04-26 14:47:34 +02:00
parent 4b8e30e649
commit 0b2e19926d
11 changed files with 57 additions and 83 deletions

View File

@@ -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