mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5883 Icons : Use framework code to apply an overlay pixmap
This commit is contained in:
parent
28aafed44b
commit
1557d695b8
@ -69,20 +69,10 @@ caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::updateIconState()
|
||||
{
|
||||
// Reset dynamic icon
|
||||
this->setUiIcon( caf::QIconProvider() );
|
||||
// Get static one
|
||||
caf::QIconProvider iconProvider = this->uiIconProvider();
|
||||
|
||||
if ( iconProvider.isNull() ) return;
|
||||
|
||||
QIcon icon = iconProvider.icon();
|
||||
|
||||
// Get a pixmap, and modify it
|
||||
|
||||
QPixmap icPixmap;
|
||||
icPixmap = icon.pixmap( 16, 16, QIcon::Normal );
|
||||
|
||||
QPixmap sign;
|
||||
if ( filterMode() == INCLUDE )
|
||||
{
|
||||
@ -93,13 +83,9 @@ void RimCellFilter::updateIconState()
|
||||
sign.load( ":/Minus.png" );
|
||||
}
|
||||
|
||||
{
|
||||
QPainter painter( &icPixmap );
|
||||
painter.drawPixmap( 0, 0, sign );
|
||||
}
|
||||
|
||||
iconProvider.setPixmap( icPixmap );
|
||||
iconProvider.setOverlayPixmap( sign );
|
||||
iconProvider.setActive( isActive && !isActive.uiCapability()->isUiReadOnly() );
|
||||
|
||||
this->setUiIcon( iconProvider );
|
||||
}
|
||||
|
||||
|
@ -680,24 +680,19 @@ void RimEnsembleCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOr
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
|
||||
// Reset dynamic icon
|
||||
this->setUiIcon( caf::QIconProvider() );
|
||||
// Get static one
|
||||
caf::QIconProvider iconProvider = this->uiIconProvider();
|
||||
|
||||
if ( iconProvider.isNull() ) return;
|
||||
|
||||
QIcon icon = iconProvider.icon();
|
||||
|
||||
RimEnsembleCurveSetCollection* coll = nullptr;
|
||||
this->firstAncestorOrThisOfType( coll );
|
||||
if ( coll && coll->curveSetForSourceStepping() == this )
|
||||
{
|
||||
QPixmap combined = icon.pixmap( 16, 16 );
|
||||
QPainter painter( &combined );
|
||||
QPixmap updownpixmap( ":/StepUpDownCorner16x16.png" );
|
||||
painter.drawPixmap( 0, 0, updownpixmap );
|
||||
iconProvider.setPixmap( combined );
|
||||
QPixmap updownpixmap( ":/StepUpDownCorner16x16.png" );
|
||||
iconProvider.setOverlayPixmap( updownpixmap );
|
||||
}
|
||||
else
|
||||
{
|
||||
iconProvider.setOverlayPixmap( QPixmap() );
|
||||
}
|
||||
|
||||
this->setUiIcon( iconProvider );
|
||||
|
@ -596,9 +596,6 @@ void RimSummaryCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderi
|
||||
{
|
||||
RimPlotCurve::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
||||
|
||||
// Reset dynamic icon
|
||||
this->setUiIcon( caf::QIconProvider() );
|
||||
// Get static one
|
||||
caf::QIconProvider iconProvider = this->uiIconProvider();
|
||||
if ( iconProvider.isNull() ) return;
|
||||
|
||||
@ -608,13 +605,16 @@ void RimSummaryCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderi
|
||||
this->firstAncestorOrThisOfType( coll );
|
||||
if ( coll && coll->curveForSourceStepping() == this )
|
||||
{
|
||||
QPixmap combined = icon.pixmap( 16, 16 );
|
||||
QPainter painter( &combined );
|
||||
QPixmap updownpixmap( ":/StepUpDownCorner16x16.png" );
|
||||
painter.drawPixmap( 0, 0, updownpixmap );
|
||||
iconProvider.setPixmap( combined );
|
||||
setUiIcon( iconProvider );
|
||||
QPixmap updownpixmap( ":/StepUpDownCorner16x16.png" );
|
||||
|
||||
iconProvider.setOverlayPixmap( updownpixmap );
|
||||
}
|
||||
else
|
||||
{
|
||||
iconProvider.setOverlayPixmap( QPixmap() );
|
||||
}
|
||||
|
||||
setUiIcon( iconProvider );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user