mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Fix crash when reopening existing layouts
This commit is contained in:
parent
b6dab6ff48
commit
ac6c131212
@ -25,6 +25,7 @@ class QgsLayoutViewToolSelect : QgsLayoutViewTool
|
||||
%Docstring
|
||||
Constructor for QgsLayoutViewToolSelect.
|
||||
%End
|
||||
~QgsLayoutViewToolSelect();
|
||||
|
||||
virtual void layoutPressEvent( QgsLayoutViewMouseEvent *event );
|
||||
|
||||
|
@ -617,6 +617,7 @@ QgsLayout *QgsLayoutDesignerDialog::currentLayout()
|
||||
|
||||
void QgsLayoutDesignerDialog::setCurrentLayout( QgsLayout *layout )
|
||||
{
|
||||
layout->deselectAll();
|
||||
mLayout = layout;
|
||||
connect( mLayout, &QgsLayout::destroyed, this, &QgsLayoutDesignerDialog::close );
|
||||
|
||||
|
@ -311,6 +311,9 @@ bool QgsLayoutMouseHandles::selectionRotation( double &rotation ) const
|
||||
|
||||
double QgsLayoutMouseHandles::rectHandlerBorderTolerance()
|
||||
{
|
||||
if ( !mView )
|
||||
return 0;
|
||||
|
||||
//calculate size for resize handles
|
||||
//get view scale factor
|
||||
double viewScaleFactor = mView->transform().m11();
|
||||
|
@ -30,6 +30,12 @@ QgsLayoutViewToolSelect::QgsLayoutViewToolSelect( QgsLayoutView *view )
|
||||
mRubberBand->setPen( QPen( QBrush( QColor( 254, 58, 29, 100 ) ), 0, Qt::DotLine ) );
|
||||
}
|
||||
|
||||
QgsLayoutViewToolSelect::~QgsLayoutViewToolSelect()
|
||||
{
|
||||
if ( mMouseHandles )
|
||||
mMouseHandles->deleteLater();
|
||||
}
|
||||
|
||||
void QgsLayoutViewToolSelect::layoutPressEvent( QgsLayoutViewMouseEvent *event )
|
||||
{
|
||||
if ( mMouseHandles->shouldBlockEvent( event ) )
|
||||
@ -276,6 +282,7 @@ QgsLayoutMouseHandles *QgsLayoutViewToolSelect::mouseHandles()
|
||||
void QgsLayoutViewToolSelect::setLayout( QgsLayout *layout )
|
||||
{
|
||||
// existing handles are owned by previous layout
|
||||
mMouseHandles->deleteLater();
|
||||
|
||||
//add mouse selection handles to layout, and initially hide
|
||||
mMouseHandles = new QgsLayoutMouseHandles( layout, view() );
|
||||
|
@ -40,6 +40,7 @@ class GUI_EXPORT QgsLayoutViewToolSelect : public QgsLayoutViewTool
|
||||
* Constructor for QgsLayoutViewToolSelect.
|
||||
*/
|
||||
QgsLayoutViewToolSelect( QgsLayoutView *view SIP_TRANSFERTHIS );
|
||||
~QgsLayoutViewToolSelect();
|
||||
|
||||
void layoutPressEvent( QgsLayoutViewMouseEvent *event ) override;
|
||||
void layoutMoveEvent( QgsLayoutViewMouseEvent *event ) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user