Navigation Menu

Skip to content

Commit

Permalink
Remove warning on closing map views
Browse files Browse the repository at this point in the history
Seemed like a good idea, but in practice it's just more annoying
than it is useful
  • Loading branch information
nyalldawson committed Mar 13, 2017
1 parent 2f01c04 commit 2694b73
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -3177,7 +3177,7 @@ void QgisApp::closeAdditionalMapCanvases()
freezeCanvases( true ); // closing docks may cause canvases to resize, and we don't want a map refresh occurring
Q_FOREACH ( QgsMapCanvasDockWidget *w, findChildren< QgsMapCanvasDockWidget * >() )
{
w->closeWithoutWarning();
w->close();
delete w;
}
freezeCanvases( false );
Expand Down
21 changes: 0 additions & 21 deletions src/app/qgsmapcanvasdockwidget.cpp
Expand Up @@ -17,7 +17,6 @@
#include "qgscsexception.h"
#include "qgsprojectionselectiondialog.h"
#include "qgsscalecombobox.h"
#include "qgsstatusbarmagnifierwidget.h"
#include "qgsdoublespinbox.h"
#include "qgssettings.h"
#include "qgsmaptoolpan.h"
Expand Down Expand Up @@ -171,12 +170,6 @@ QgsMapCanvas *QgsMapCanvasDockWidget::mapCanvas()
return mMapCanvas;
}

void QgsMapCanvasDockWidget::closeWithoutWarning()
{
mShowCloseWarning = false;
close();
}

void QgsMapCanvasDockWidget::setViewExtentSynchronized( bool enabled )
{
mActionSyncView->setChecked( enabled );
Expand All @@ -187,20 +180,6 @@ bool QgsMapCanvasDockWidget::isViewExtentSynchronized() const
return mActionSyncView->isChecked();
}

void QgsMapCanvasDockWidget::closeEvent( QCloseEvent *event )
{
if ( mShowCloseWarning && mMapCanvas->layerCount() > 0
&& QMessageBox::question( this, tr( "Close map view" ),
tr( "Are you sure you want to close this map view?" ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) == QMessageBox::No )
{
event->ignore();
}
else
{
event->accept();
}
}

void QgsMapCanvasDockWidget::setMapCrs()
{
QgsProjectionSelectionDialog dlg;
Expand Down
10 changes: 0 additions & 10 deletions src/app/qgsmapcanvasdockwidget.h
Expand Up @@ -49,11 +49,6 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM
*/
QgsMapCanvas *mapCanvas();

/**
* Closes the dock, bypassing the usual warning prompt.
*/
void closeWithoutWarning();

/**
* Sets whether the view extent should be synchronized with the main canvas extent.
*/
Expand All @@ -65,10 +60,6 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM

void renameTriggered();

protected:

virtual void closeEvent( QCloseEvent *event ) override;

private slots:

void setMapCrs();
Expand All @@ -82,7 +73,6 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM

QgsMapCanvas *mMapCanvas = nullptr;
QgsMapCanvas *mMainCanvas = nullptr;
bool mShowCloseWarning = true;
QMenu *mMenu = nullptr;
QList<QAction *> mMenuPresetActions;
QgsScaleComboBox *mScaleCombo = nullptr;
Expand Down

0 comments on commit 2694b73

Please sign in to comment.