Skip to content

Commit 29d4fbb

Browse files
committed
Avoid QObject::connect null warning
(cherry picked from commit a8ecc68)
1 parent 83aa32c commit 29d4fbb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/gui/qgsmapcanvas.cpp

+3-1
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)