Пример #1
0
bool QgsPaintEffectRegistry::isDefaultStack( QgsPaintEffect* effect )
{
  QgsEffectStack* effectStack = dynamic_cast< QgsEffectStack* >( effect );
  if ( !effectStack )
    return false;

  if ( effectStack->count() != 5 )
    return false;

  for ( int i = 0; i < 5; ++i )
  {
    //only the third effect should be enabled
    if ( effectStack->effect( i )->enabled() != ( i == 2 ) )
      return false;
  }

  if ( !dynamic_cast< QgsDropShadowEffect* >( effectStack->effect( 0 ) ) )
    return false;
  if ( !dynamic_cast< QgsOuterGlowEffect* >( effectStack->effect( 1 ) ) )
    return false;
  if ( !dynamic_cast< QgsDrawSourceEffect* >( effectStack->effect( 2 ) ) )
    return false;
  if ( !dynamic_cast< QgsInnerShadowEffect* >( effectStack->effect( 3 ) ) )
    return false;
  if ( !dynamic_cast< QgsInnerGlowEffect* >( effectStack->effect( 4 ) ) )
    return false;

  //we don't go as far as to check the individual effect's properties
  return true;
}
Пример #2
0
QgsEffectStack::QgsEffectStack( const QgsEffectStack &other )
    : QgsPaintEffect( other )
{
  //deep copy
  for ( int i = 0; i < other.count(); ++i )
  {
    appendEffect( other.effect( i )->clone() );
  }
}