Skip to content

Commit a8ecc68

Browse files
committedNov 19, 2018
Avoid QObject::connect null warning
1 parent 34c217c commit a8ecc68

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,11 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
172172
moveCanvasContents( true );
173173

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.