Skip to content
Permalink
Browse files

Merge pull request #42475 from m-kuhn/desktopwidget

[qt6] goodbye QDesktopWidget
  • Loading branch information
m-kuhn committed Mar 25, 2021
2 parents 31513ba + 7e3815f commit 47bd6607a8ca8b10346ff1222dc8726a87622029
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/core/labeling/qgspallabeling.cpp
@@ -38,7 +38,11 @@
#include <QFontMetrics>
#include <QTime>
#include <QPainter>
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QDesktopWidget>
#else
#include <QScreen>
#endif
#include <QTextBoundaryFinder>

#include "diagram/qgsdiagram.h"
@@ -1302,7 +1306,13 @@ QPixmap QgsPalLayerSettings::labelSettingsPreviewPixmap( const QgsPalLayerSettin
context.setMapToPixel( newCoordXForm );
context.setFlag( QgsRenderContext::Antialiasing, true );

context.setScaleFactor( QgsApplication::desktop()->logicalDpiX() / 25.4 );
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const double logicalDpiX = QgsApplication::desktop()->logicalDpiX();
#else
const double logicalDpiX = QApplication::topLevelWidgets().first()->screen()->devicePixelRatio();
#endif
context.setScaleFactor( logicalDpiX / 25.4 );

context.setUseAdvancedEffects( true );
context.setPainter( &painter );

0 comments on commit 47bd660

Please sign in to comment.