Skip to content

Commit

Permalink
[qt6] goodbye QDesktopWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 25, 2021
1 parent 8e8febb commit 7e3815f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core/labeling/qgspallabeling.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );

Expand Down

0 comments on commit 7e3815f

Please sign in to comment.