Skip to content

Commit

Permalink
georeferencer: fix closeEvent handling for dock widget.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13561 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mmassing committed May 24, 2010
1 parent 5a8575f commit 90827ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/plugins/georeferencer/qgsgeorefplugingui.cpp
Expand Up @@ -62,20 +62,22 @@


#include "qgsgeorefplugingui.h" #include "qgsgeorefplugingui.h"


class QgsGeorefDockWidget : public QDockWidget
QgsGeorefDockWidget::QgsGeorefDockWidget( const QString & title, QWidget * parent, Qt::WindowFlags flags )
: QDockWidget( title, parent, flags )
{ {
public: setObjectName( "GeorefDockWidget" ); // set object name so the position can be saved
QgsGeorefDockWidget( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ) }
: QDockWidget( title, parent, flags )
{
setObjectName( "GeorefDockWidget" ); // set object name so the position can be saved
}


virtual void closeEvent( QCloseEvent * ev ) void QgsGeorefDockWidget::closeEvent( QCloseEvent * ev )
{ {
deleteLater(); if (widget() && !widget()->close())
} {
}; ev->ignore();
return;
}
deleteLater();
}


QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent, Qt::WFlags fl ) QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent, Qt::WFlags fl )
: QMainWindow( parent, fl ) : QMainWindow( parent, fl )
Expand Down Expand Up @@ -130,7 +132,6 @@ void QgsGeorefPluginGui::dockThisWindow( bool dock )
{ {
mDock = new QgsGeorefDockWidget( tr( "Georeferencer" ), mIface->mainWindow() ); mDock = new QgsGeorefDockWidget( tr( "Georeferencer" ), mIface->mainWindow() );
mDock->setWidget( this ); mDock->setWidget( this );
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
mIface->addDockWidget( Qt::BottomDockWidgetArea, mDock ); mIface->addDockWidget( Qt::BottomDockWidgetArea, mDock );
} }
} }
Expand All @@ -151,6 +152,7 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
delete mToolAddPoint; delete mToolAddPoint;
delete mToolDeletePoint; delete mToolDeletePoint;
delete mToolMovePoint; delete mToolMovePoint;

} }


// ----------------------------- protected --------------------------------- // // ----------------------------- protected --------------------------------- //
Expand Down Expand Up @@ -929,8 +931,8 @@ void QgsGeorefPluginGui::createDockWidgets()
dockWidgetGCPpoints->setWidget( mGCPListWidget ); dockWidgetGCPpoints->setWidget( mGCPListWidget );


connect( mGCPListWidget, SIGNAL( jumpToGCP( uint ) ), this, SLOT( jumpToGCP( uint ) ) ); connect( mGCPListWidget, SIGNAL( jumpToGCP( uint ) ), this, SLOT( jumpToGCP( uint ) ) );
connect( mGCPListWidget, SIGNAL( replaceDataPoint( QgsGeorefDataPoint*, int ) ), /*connect( mGCPListWidget, SIGNAL( replaceDataPoint( QgsGeorefDataPoint*, int ) ),
this, SLOT( replaceDataPoint( QgsGeorefDataPoint*, int ) ) ); this, SLOT( replaceDataPoint( QgsGeorefDataPoint*, int ) ) );*/
connect( mGCPListWidget, SIGNAL( deleteDataPoint( int ) ), connect( mGCPListWidget, SIGNAL( deleteDataPoint( int ) ),
this, SLOT( deleteDataPoint( int ) ) ); this, SLOT( deleteDataPoint( int ) ) );
connect( mGCPListWidget, SIGNAL( pointEnabled( QgsGeorefDataPoint*, int ) ), this, SLOT( updateGeorefTransform() ) ); connect( mGCPListWidget, SIGNAL( pointEnabled( QgsGeorefDataPoint*, int ) ), this, SLOT( updateGeorefTransform() ) );
Expand Down
9 changes: 9 additions & 0 deletions src/plugins/georeferencer/qgsgeorefplugingui.h
Expand Up @@ -225,4 +225,13 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas


QDockWidget* mDock; QDockWidget* mDock;
}; };

class QgsGeorefDockWidget : public QDockWidget
{
Q_OBJECT
public:
QgsGeorefDockWidget( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 );
virtual void closeEvent( QCloseEvent * ev );
};

#endif #endif

0 comments on commit 90827ff

Please sign in to comment.