Skip to content
Permalink
Browse files

Fix too small symbol layer preview icon on hidpi displays

  • Loading branch information
nyalldawson committed Jan 16, 2019
1 parent 3c0c253 commit 9014be0d37aa41327785ee2c360e492867c9fbf5
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/gui/symbology/qgssymbolselectordialog.cpp
@@ -36,6 +36,7 @@
#include "qgssvgcache.h"
#include "qgsimagecache.h"
#include "qgsproject.h"
#include "qgsguiutils.h"

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

///@endcond

0 comments on commit 9014be0

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