mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Don't resize canvas size on widget change
This commit is contained in:
parent
0739750e20
commit
ef51b702b8
@ -1352,13 +1352,11 @@ void QgsMapCanvas::mouseReleaseEvent( QMouseEvent* e )
|
||||
|
||||
} // mouseReleaseEvent
|
||||
|
||||
void QgsMapCanvas::resizeEvent( QResizeEvent * e )
|
||||
void QgsMapCanvas::updateMapSize()
|
||||
{
|
||||
QGraphicsView::resizeEvent( e );
|
||||
mResizeTimer->start( 500 );
|
||||
|
||||
QSize lastSize = viewport()->size();
|
||||
|
||||
mSettings.setOutputSize( lastSize );
|
||||
mMapRenderer->setOutputSize( lastSize, mSettings.outputDpi() );
|
||||
|
||||
@ -1376,12 +1374,28 @@ void QgsMapCanvas::resizeEvent( QResizeEvent * e )
|
||||
emit extentsChanged();
|
||||
}
|
||||
|
||||
|
||||
void QgsMapCanvas::resizeEvent( QResizeEvent * e )
|
||||
{
|
||||
QGraphicsView::resizeEvent( e );
|
||||
|
||||
QSize size = viewport()->size();
|
||||
if ( size.width() > mSettings.outputSize().width() || size.height() > mSettings.outputSize().height() )
|
||||
{
|
||||
updateMapSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
moveCanvasContents( true );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsMapCanvas::paintEvent( QPaintEvent *e )
|
||||
{
|
||||
// no custom event handling anymore
|
||||
|
||||
QGraphicsView::paintEvent( e );
|
||||
} // paintEvent
|
||||
}
|
||||
|
||||
void QgsMapCanvas::updateCanvasItemPositions()
|
||||
{
|
||||
|
@ -501,6 +501,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
//! @note added in 2.8
|
||||
static void enableRotation( bool enabled );
|
||||
|
||||
|
||||
private slots:
|
||||
//! called when current maptool is destroyed
|
||||
void mapToolDestroyed();
|
||||
@ -746,6 +747,10 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
|
||||
QgsExpressionContextScope mExpressionContextScope;
|
||||
|
||||
//! Force a resize of the map canvas item
|
||||
//! @note added in 2.16
|
||||
void updateMapSize();
|
||||
|
||||
}; // class QgsMapCanvas
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user