From a8ecc683b72a3842a480e3e562456cbec8bad667 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 19 Nov 2018 14:43:58 +1000 Subject: [PATCH] Avoid QObject::connect null warning --- src/gui/qgsmapcanvas.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index eb6a95fd9cd..1075331039e 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -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 );