Skip to content
Permalink
Browse files

Use widget's logicalDpiX() instead of a screens

Fixes #34772
  • Loading branch information
nyalldawson committed Mar 5, 2020
1 parent 6548d6c commit e7ac0ee1215b59cd7b348e20791ec2beabf478be
@@ -86,6 +86,7 @@ Shiva Reddy Koti
Stefanie Tellex
Steven Mizuno
Tamas Szekeres
Tim Tisler
Tom Russo
Tyler Mitchell
Vita Cizek
@@ -956,8 +956,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
const int horizontalDpi = qApp->desktop()->screen()->logicalDpiX();
#else
QScreen *screen = QGuiApplication::screenAt( mapToGlobal( QPoint( width() / 2, 0 ) ) );
const int horizontalDpi = screen->logicalDotsPerInchX();
const int horizontalDpi = logicalDpiX();
#endif


@@ -50,8 +50,7 @@ void QgsHtmlWidgetWrapper::initWidget( QWidget *editor )
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
const int horizontalDpi = qApp->desktop()->screen()->logicalDpiX();
#else
QScreen *screen = QGuiApplication::screenAt( mWidget->mapToGlobal( QPoint( mWidget->width() / 2, 0 ) ) );
const int horizontalDpi = screen->logicalDotsPerInchX();
const int horizontalDpi = mWidget->logicalDpiX();
#endif

mWidget->setZoomFactor( horizontalDpi / 96.0 );
@@ -451,8 +451,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
const int horizontalDpi = qApp->desktop()->screen()->logicalDpiX();
#else
QScreen *screen = QGuiApplication::screenAt( mapToGlobal( QPoint( width() / 2, 0 ) ) );
const int horizontalDpi = screen->logicalDotsPerInchX();
const int horizontalDpi = logicalDpiX();
#endif

// Adjust zoom: text is ok, but HTML seems rather big at least on Linux/KDE

0 comments on commit e7ac0ee

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