Skip to content

Commit d4b96cc

Browse files
author
mmassing
committedMay 24, 2010
georeferencer: fix closeEvent handling for dock widget.
git-svn-id: http://svn.osgeo.org/qgis/trunk@13561 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 6c517c4 commit d4b96cc

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed
 

‎src/plugins/georeferencer/qgsgeorefplugingui.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,22 @@
6262

6363
#include "qgsgeorefplugingui.h"
6464

65-
class QgsGeorefDockWidget : public QDockWidget
65+
66+
QgsGeorefDockWidget::QgsGeorefDockWidget( const QString & title, QWidget * parent, Qt::WindowFlags flags )
67+
: QDockWidget( title, parent, flags )
6668
{
67-
public:
68-
QgsGeorefDockWidget( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
69-
: QDockWidget( title, parent, flags )
70-
{
71-
setObjectName( "GeorefDockWidget" ); // set object name so the position can be saved
72-
}
69+
setObjectName( "GeorefDockWidget" ); // set object name so the position can be saved
70+
}
7371

74-
virtual void closeEvent( QCloseEvent * ev )
75-
{
76-
deleteLater();
77-
}
78-
};
72+
void QgsGeorefDockWidget::closeEvent( QCloseEvent * ev )
73+
{
74+
if (widget() && !widget()->close())
75+
{
76+
ev->ignore();
77+
return;
78+
}
79+
deleteLater();
80+
}
7981

8082
QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent, Qt::WFlags fl )
8183
: QMainWindow( parent, fl )
@@ -130,7 +132,6 @@ void QgsGeorefPluginGui::dockThisWindow( bool dock )
130132
{
131133
mDock = new QgsGeorefDockWidget( tr( "Georeferencer" ), mIface->mainWindow() );
132134
mDock->setWidget( this );
133-
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
134135
mIface->addDockWidget( Qt::BottomDockWidgetArea, mDock );
135136
}
136137
}
@@ -151,6 +152,7 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
151152
delete mToolAddPoint;
152153
delete mToolDeletePoint;
153154
delete mToolMovePoint;
155+
154156
}
155157

156158
// ----------------------------- protected --------------------------------- //
@@ -929,8 +931,8 @@ void QgsGeorefPluginGui::createDockWidgets()
929931
dockWidgetGCPpoints->setWidget( mGCPListWidget );
930932

931933
connect( mGCPListWidget, SIGNAL( jumpToGCP( uint ) ), this, SLOT( jumpToGCP( uint ) ) );
932-
connect( mGCPListWidget, SIGNAL( replaceDataPoint( QgsGeorefDataPoint*, int ) ),
933-
this, SLOT( replaceDataPoint( QgsGeorefDataPoint*, int ) ) );
934+
/*connect( mGCPListWidget, SIGNAL( replaceDataPoint( QgsGeorefDataPoint*, int ) ),
935+
this, SLOT( replaceDataPoint( QgsGeorefDataPoint*, int ) ) );*/
934936
connect( mGCPListWidget, SIGNAL( deleteDataPoint( int ) ),
935937
this, SLOT( deleteDataPoint( int ) ) );
936938
connect( mGCPListWidget, SIGNAL( pointEnabled( QgsGeorefDataPoint*, int ) ), this, SLOT( updateGeorefTransform() ) );

‎src/plugins/georeferencer/qgsgeorefplugingui.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,13 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
225225

226226
QDockWidget* mDock;
227227
};
228+
229+
class QgsGeorefDockWidget : public QDockWidget
230+
{
231+
Q_OBJECT
232+
public:
233+
QgsGeorefDockWidget( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 );
234+
virtual void closeEvent( QCloseEvent * ev );
235+
};
236+
228237
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.