Skip to content

Commit

Permalink
update DPR on screen or resolution change
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 19, 2018
1 parent b4e87d8 commit 35ec465
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );

Expand Down

0 comments on commit 35ec465

Please sign in to comment.