Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid QObject::connect null warning
  • Loading branch information
nyalldawson committed Nov 19, 2018
1 parent 34c217c commit a8ecc68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -172,9 +172,11 @@ 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() );} );
if ( window()->windowHandle() )
{
connect( window()->windowHandle(), &QWindow::screenChanged, this, [ = ]( QScreen * ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );
connect( window()->windowHandle()->screen(), &QScreen::physicalDotsPerInchChanged, this, [ = ]( qreal ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );
}

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

0 comments on commit a8ecc68

Please sign in to comment.