Skip to content
Permalink
Browse files

Fix too small symbol layer preview icon on hidpi displays

(cherry picked from commit 9014be0)
  • Loading branch information
nyalldawson committed Jan 17, 2019
1 parent 387334d commit 8127c701c432dcfcf2bf2a262e0c624cabac7517
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/gui/symbology/qgssymbolselectordialog.cpp
@@ -34,6 +34,7 @@
#include "qgsfeatureiterator.h"
#include "qgsvectorlayer.h"
#include "qgssvgcache.h"
#include "qgsguiutils.h"

#include <QColorDialog>
#include <QPainter>
@@ -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() )
@@ -212,6 +218,7 @@ class SymbolLayerItem : public QStandardItem
QgsSymbolLayer *mLayer = nullptr;
QgsSymbol *mSymbol = nullptr;
bool mIsLayer;
QSize mSize;
};

///@endcond

0 comments on commit 8127c70

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