Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use widget's logicalDpiX() instead of a screens
Fixes #34772
  • Loading branch information
nyalldawson committed Mar 5, 2020
1 parent 6548d6c commit e7ac0ee
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/CONTRIBUTORS
Expand Up @@ -86,6 +86,7 @@ Shiva Reddy Koti
Stefanie Tellex
Steven Mizuno
Tamas Szekeres
Tim Tisler
Tom Russo
Tyler Mitchell
Vita Cizek
Expand Down
3 changes: 1 addition & 2 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -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


Expand Down
3 changes: 1 addition & 2 deletions src/gui/editorwidgets/qgshtmlwidgetwrapper.cpp
Expand Up @@ -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 );
Expand Down
3 changes: 1 addition & 2 deletions src/gui/raster/qgsrasterlayerproperties.cpp
Expand Up @@ -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
Expand Down

0 comments on commit e7ac0ee

Please sign in to comment.