Skip to content

Commit 8714e42

Browse files
committedApr 17, 2018
Use wait cursor during lengthy operations in style manager dialog
1 parent 95c48f1 commit 8714e42

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎src/gui/symbology/qgsstyleexportimportdialog.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "qgscolorramp.h"
2424
#include "qgslogger.h"
2525
#include "qgsstylegroupselectiondialog.h"
26+
#include "qgsguiutils.h"
2627

2728
#include <QInputDialog>
2829
#include <QCloseEvent>
@@ -143,23 +144,27 @@ void QgsStyleExportImportDialog::doExportImport()
143144

144145
mFileName = fileName;
145146

147+
QgsTemporaryCursorOverride override( Qt::WaitCursor );
146148
moveStyles( &selection, mStyle, mTempStyle );
147149
if ( !mTempStyle->exportXml( mFileName ) )
148150
{
151+
override.release();
149152
QMessageBox::warning( this, tr( "Export Symbols" ),
150153
tr( "Error when saving selected symbols to file:\n%1" )
151154
.arg( mTempStyle->errorString() ) );
152155
return;
153156
}
154157
else
155158
{
159+
override.release();
156160
QMessageBox::information( this, tr( "Export Symbols" ),
157161
tr( "The selected symbols were successfully exported to file:\n%1" )
158162
.arg( mFileName ) );
159163
}
160164
}
161165
else // import
162166
{
167+
QgsTemporaryCursorOverride override( Qt::WaitCursor );
163168
moveStyles( &selection, mTempStyle, mStyle );
164169

165170
// clear model
@@ -174,12 +179,15 @@ void QgsStyleExportImportDialog::doExportImport()
174179

175180
bool QgsStyleExportImportDialog::populateStyles( QgsStyle *style )
176181
{
182+
QgsTemporaryCursorOverride override( Qt::WaitCursor );
183+
177184
// load symbols and color ramps from file
178185
if ( mDialogMode == Import )
179186
{
180187
// NOTE mTempStyle is style here
181188
if ( !style->importXml( mFileName ) )
182189
{
190+
override.release();
183191
QMessageBox::warning( this, tr( "Import Symbols or Color Ramps" ),
184192
tr( "An error occurred during import:\n%1" ).arg( style->errorString() ) );
185193
return false;

‎src/gui/symbology/qgsstylemanagerdialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ bool QgsStyleManagerDialog::removeSymbol()
778778
QMessageBox::No ) )
779779
return false;
780780

781+
QgsTemporaryCursorOverride override( Qt::WaitCursor );
782+
781783
Q_FOREACH ( const QModelIndex &index, indexes )
782784
{
783785
QString symbolName = index.data().toString();
@@ -798,6 +800,8 @@ bool QgsStyleManagerDialog::removeColorRamp()
798800
QMessageBox::No ) )
799801
return false;
800802

803+
QgsTemporaryCursorOverride override( Qt::WaitCursor );
804+
801805
Q_FOREACH ( const QModelIndex &index, indexes )
802806
{
803807
QString rampName = index.data().toString();

0 commit comments

Comments
 (0)
Please sign in to comment.