Skip to content
Permalink
Browse files

Remove warning on closing map views

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 2694b7379c9cfe2d8bfcf450627adf328a2295d8
Showing with 1 addition and 32 deletions.
  1. +1 −1 src/app/qgisapp.cpp
  2. +0 −21 src/app/qgsmapcanvasdockwidget.cpp
  3. +0 −10 src/app/qgsmapcanvasdockwidget.h
@@ -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 );
@@ -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"
@@ -171,12 +170,6 @@ QgsMapCanvas *QgsMapCanvasDockWidget::mapCanvas()
return mMapCanvas;
}

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

void QgsMapCanvasDockWidget::setViewExtentSynchronized( bool enabled )
{
mActionSyncView->setChecked( enabled );
@@ -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;
@@ -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.
*/
@@ -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();
@@ -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;

0 comments on commit 2694b73

Please sign in to comment.
You can’t perform that action at this time.