Skip to content
Permalink
Browse files

Avoid unnecessary icon creation

  • Loading branch information
nyalldawson committed Sep 13, 2018
1 parent 454cbda commit 392755918a67d6ed485fdb144fa9eb1767f99839
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/core/symbology/qgsstylemodel.cpp
@@ -86,7 +86,8 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const
return icon;

std::unique_ptr< QgsSymbol > symbol( mStyle->symbol( name ) );
icon.addPixmap( QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( 24, 24 ), 1 ) );
if ( mAdditionalSizes.isEmpty() )
icon.addPixmap( QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( 24, 24 ), 1 ) );

for ( const QVariant &size : mAdditionalSizes )
{
@@ -105,7 +106,8 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const
return icon;

std::unique_ptr< QgsColorRamp > ramp( mStyle->colorRamp( name ) );
icon.addPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( ramp.get(), QSize( 24, 24 ), 1 ) );
if ( mAdditionalSizes.isEmpty() )
icon.addPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( ramp.get(), QSize( 24, 24 ), 1 ) );
for ( const QVariant &size : mAdditionalSizes )
{
QSize s = size.toSize();

0 comments on commit 3927559

Please sign in to comment.
You can’t perform that action at this time.