Skip to content
Permalink
Browse files

update DPR on screen or resolution change

  • Loading branch information
3nids committed Oct 19, 2018
1 parent b4e87d8 commit 35ec465847c50d679306537e844a72c227810b4f
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/gui/qgsmapcanvas.cpp
@@ -31,9 +31,11 @@ email : sherman at mrcc.com
#include <QRect>
#include <QTextStream>
#include <QResizeEvent>
#include <QScreen>
#include <QString>
#include <QStringList>
#include <QWheelEvent>
#include <QWindow>

#include "qgis.h"
#include "qgssettings.h"
@@ -169,6 +171,10 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )

moveCanvasContents( true );

// keep device pixel ratio up to date on screen or resolution change
connect( window()->windowHandle(), &QWindow::screenChanged, this, [ = ]( QScreen * ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );
connect( window()->windowHandle()->screen(), &QScreen::physicalDotsPerInchChanged, [ = ]( qreal ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );

connect( &mMapUpdateTimer, &QTimer::timeout, this, &QgsMapCanvas::mapUpdateTimeout );
mMapUpdateTimer.setInterval( 250 );

0 comments on commit 35ec465

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