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
  • Loading branch information
nyalldawson committed Jan 16, 2019
1 parent 3c0c253 commit 9014be0
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 @@ -36,6 +36,7 @@
#include "qgssvgcache.h"
#include "qgsimagecache.h"
#include "qgsproject.h"
#include "qgsguiutils.h"

#include <QColorDialog>
#include <QPainter>
Expand Down Expand Up @@ -147,11 +148,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 @@ -214,6 +220,7 @@ class SymbolLayerItem : public QStandardItem
QgsSymbolLayer *mLayer = nullptr;
QgsSymbol *mSymbol = nullptr;
bool mIsLayer;
QSize mSize;
};

///@endcond
Expand Down

0 comments on commit 9014be0

Please sign in to comment.