Skip to content
Permalink
Browse files

[layer tree] Avoid blurry icons on devices with a pixel ratio != 1

  • Loading branch information
nirvn committed Oct 15, 2020
1 parent 303e6c8 commit 76cfbabfe38a2465003a8dde3d4c2a4b5ce1b812
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/core/layertree/qgslayertreemodel.cpp
@@ -13,6 +13,8 @@
* *
***************************************************************************/

#include <QApplication>
#include <QDesktopWidget>
#include <QMimeData>
#include <QTextStream>

@@ -723,7 +725,10 @@ int QgsLayerTreeModel::scaleIconSize( int standardSize )
{
QFontMetrics fm( ( QFont() ) );
const double scale = 1.1 * standardSize / 24;
return static_cast< int >( std::floor( std::max( Qgis::UI_SCALE_FACTOR * fm.height() * scale, static_cast< double >( standardSize ) ) ) );
int scaledIconSize = static_cast< int >( std::floor( std::max( Qgis::UI_SCALE_FACTOR * fm.height() * scale, static_cast< double >( standardSize ) ) ) );
if ( QApplication::desktop() )
scaledIconSize *= QApplication::desktop()->devicePixelRatio();
return scaledIconSize;
}

void QgsLayerTreeModel::nodeWillAddChildren( QgsLayerTreeNode *node, int indexFrom, int indexTo )

0 comments on commit 76cfbab

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