Skip to content

Commit

Permalink
Use widget's logicalDpiX() instead of a screens
Browse files Browse the repository at this point in the history
Fixes #34772

(cherry picked from commit e7ac0ee)
  • Loading branch information
nyalldawson committed Mar 16, 2020
1 parent c6b2970 commit 0e73f44
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 @@ -445,8 +445,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 0e73f44

Please sign in to comment.