Skip to content

Commit 2694b73

Browse files
committed
Remove warning on closing map views
Seemed like a good idea, but in practice it's just more annoying than it is useful
1 parent 2f01c04 commit 2694b73

File tree

3 files changed

+1
-32
lines changed

3 files changed

+1
-32
lines changed

src/app/qgisapp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3177,7 +3177,7 @@ void QgisApp::closeAdditionalMapCanvases()
31773177
freezeCanvases( true ); // closing docks may cause canvases to resize, and we don't want a map refresh occurring
31783178
Q_FOREACH ( QgsMapCanvasDockWidget *w, findChildren< QgsMapCanvasDockWidget * >() )
31793179
{
3180-
w->closeWithoutWarning();
3180+
w->close();
31813181
delete w;
31823182
}
31833183
freezeCanvases( false );

src/app/qgsmapcanvasdockwidget.cpp

-21
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "qgscsexception.h"
1818
#include "qgsprojectionselectiondialog.h"
1919
#include "qgsscalecombobox.h"
20-
#include "qgsstatusbarmagnifierwidget.h"
2120
#include "qgsdoublespinbox.h"
2221
#include "qgssettings.h"
2322
#include "qgsmaptoolpan.h"
@@ -171,12 +170,6 @@ QgsMapCanvas *QgsMapCanvasDockWidget::mapCanvas()
171170
return mMapCanvas;
172171
}
173172

174-
void QgsMapCanvasDockWidget::closeWithoutWarning()
175-
{
176-
mShowCloseWarning = false;
177-
close();
178-
}
179-
180173
void QgsMapCanvasDockWidget::setViewExtentSynchronized( bool enabled )
181174
{
182175
mActionSyncView->setChecked( enabled );
@@ -187,20 +180,6 @@ bool QgsMapCanvasDockWidget::isViewExtentSynchronized() const
187180
return mActionSyncView->isChecked();
188181
}
189182

190-
void QgsMapCanvasDockWidget::closeEvent( QCloseEvent *event )
191-
{
192-
if ( mShowCloseWarning && mMapCanvas->layerCount() > 0
193-
&& QMessageBox::question( this, tr( "Close map view" ),
194-
tr( "Are you sure you want to close this map view?" ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) == QMessageBox::No )
195-
{
196-
event->ignore();
197-
}
198-
else
199-
{
200-
event->accept();
201-
}
202-
}
203-
204183
void QgsMapCanvasDockWidget::setMapCrs()
205184
{
206185
QgsProjectionSelectionDialog dlg;

src/app/qgsmapcanvasdockwidget.h

-10
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM
4949
*/
5050
QgsMapCanvas *mapCanvas();
5151

52-
/**
53-
* Closes the dock, bypassing the usual warning prompt.
54-
*/
55-
void closeWithoutWarning();
56-
5752
/**
5853
* Sets whether the view extent should be synchronized with the main canvas extent.
5954
*/
@@ -65,10 +60,6 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM
6560

6661
void renameTriggered();
6762

68-
protected:
69-
70-
virtual void closeEvent( QCloseEvent *event ) override;
71-
7263
private slots:
7364

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

8374
QgsMapCanvas *mMapCanvas = nullptr;
8475
QgsMapCanvas *mMainCanvas = nullptr;
85-
bool mShowCloseWarning = true;
8676
QMenu *mMenu = nullptr;
8777
QList<QAction *> mMenuPresetActions;
8878
QgsScaleComboBox *mScaleCombo = nullptr;

0 commit comments

Comments
 (0)