Skip to content
Permalink
Browse files

test that window handle actually exists (avoid crash in tests)

  • Loading branch information
3nids committed Oct 19, 2018
1 parent 35ec465 commit c1ce03cd3b1e9afba28b60594f4dd86ab02e8eb4
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/gui/qgsmapcanvas.cpp
@@ -173,7 +173,8 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )

// 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() );} );
if ( window()->windowHandle() )
connect( window()->windowHandle()->screen(), &QScreen::physicalDotsPerInchChanged, [ = ]( qreal ) {mSettings.setDevicePixelRatio( devicePixelRatio() );} );

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

0 comments on commit c1ce03c

Please sign in to comment.
You can’t perform that action at this time.