Skip to content

Commit

Permalink
Fix too small symbol layer preview icon on hidpi displays
Browse files Browse the repository at this point in the history
(cherry picked from commit 9014be0)
  • Loading branch information
nyalldawson committed Jan 17, 2019
1 parent 387334d commit 8127c70
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/gui/symbology/qgssymbolselectordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "qgsfeatureiterator.h"
#include "qgsvectorlayer.h"
#include "qgssvgcache.h"
#include "qgsguiutils.h"

#include <QColorDialog>
#include <QPainter>
Expand Down Expand Up @@ -145,11 +146,16 @@ class SymbolLayerItem : public QStandardItem

void updatePreview()
{
if ( !mSize.isValid() )
{
const int size = QgsGuiUtils::scaleIconSize( 16 );
mSize = QSize( size, size );
}
QIcon icon;
if ( mIsLayer )
icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon( mLayer, QgsUnitTypes::RenderMillimeters, QSize( 16, 16 ) ); //todo: make unit a parameter
icon = QgsSymbolLayerUtils::symbolLayerPreviewIcon( mLayer, QgsUnitTypes::RenderMillimeters, mSize ); //todo: make unit a parameter
else
icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSymbol, QSize( 16, 16 ) );
icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSymbol, mSize );
setIcon( icon );

if ( parent() )
Expand Down Expand Up @@ -212,6 +218,7 @@ class SymbolLayerItem : public QStandardItem
QgsSymbolLayer *mLayer = nullptr;
QgsSymbol *mSymbol = nullptr;
bool mIsLayer;
QSize mSize;
};

///@endcond
Expand Down

0 comments on commit 8127c70

Please sign in to comment.