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@13561 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mmassing committed May 24, 2010
1 parent 6c517c4 commit d4b96cc
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"

class QgsGeorefDockWidget : public QDockWidget

QgsGeorefDockWidget::QgsGeorefDockWidget( const QString & title, QWidget * parent, Qt::WindowFlags flags )
: QDockWidget( title, parent, flags )
{
public:
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
}
setObjectName( "GeorefDockWidget" ); // set object name so the position can be saved
}

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

QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent, Qt::WFlags 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->setWidget( this );
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
mIface->addDockWidget( Qt::BottomDockWidgetArea, mDock );
}
}
Expand All @@ -151,6 +152,7 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
delete mToolAddPoint;
delete mToolDeletePoint;
delete mToolMovePoint;

}

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

connect( mGCPListWidget, SIGNAL( jumpToGCP( uint ) ), this, SLOT( jumpToGCP( uint ) ) );
connect( mGCPListWidget, SIGNAL( replaceDataPoint( QgsGeorefDataPoint*, int ) ),
this, SLOT( replaceDataPoint( QgsGeorefDataPoint*, int ) ) );
/*connect( mGCPListWidget, SIGNAL( replaceDataPoint( QgsGeorefDataPoint*, int ) ),
this, SLOT( replaceDataPoint( QgsGeorefDataPoint*, int ) ) );*/
connect( mGCPListWidget, SIGNAL( deleteDataPoint( int ) ),
this, SLOT( deleteDataPoint( int ) ) );
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;
};

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

#endif

0 comments on commit d4b96cc

Please sign in to comment.