Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use wait cursor during lengthy operations in style manager dialog
  • Loading branch information
nyalldawson committed Apr 17, 2018
1 parent 95c48f1 commit 8714e42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gui/symbology/qgsstyleexportimportdialog.cpp
Expand Up @@ -23,6 +23,7 @@
#include "qgscolorramp.h"
#include "qgslogger.h"
#include "qgsstylegroupselectiondialog.h"
#include "qgsguiutils.h"

#include <QInputDialog>
#include <QCloseEvent>
Expand Down Expand Up @@ -143,23 +144,27 @@ void QgsStyleExportImportDialog::doExportImport()

mFileName = fileName;

QgsTemporaryCursorOverride override( Qt::WaitCursor );
moveStyles( &selection, mStyle, mTempStyle );
if ( !mTempStyle->exportXml( mFileName ) )
{
override.release();
QMessageBox::warning( this, tr( "Export Symbols" ),
tr( "Error when saving selected symbols to file:\n%1" )
.arg( mTempStyle->errorString() ) );
return;
}
else
{
override.release();
QMessageBox::information( this, tr( "Export Symbols" ),
tr( "The selected symbols were successfully exported to file:\n%1" )
.arg( mFileName ) );
}
}
else // import
{
QgsTemporaryCursorOverride override( Qt::WaitCursor );
moveStyles( &selection, mTempStyle, mStyle );

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

bool QgsStyleExportImportDialog::populateStyles( QgsStyle *style )
{
QgsTemporaryCursorOverride override( Qt::WaitCursor );

// load symbols and color ramps from file
if ( mDialogMode == Import )
{
// NOTE mTempStyle is style here
if ( !style->importXml( mFileName ) )
{
override.release();
QMessageBox::warning( this, tr( "Import Symbols or Color Ramps" ),
tr( "An error occurred during import:\n%1" ).arg( style->errorString() ) );
return false;
Expand Down
4 changes: 4 additions & 0 deletions src/gui/symbology/qgsstylemanagerdialog.cpp
Expand Up @@ -778,6 +778,8 @@ bool QgsStyleManagerDialog::removeSymbol()
QMessageBox::No ) )
return false;

QgsTemporaryCursorOverride override( Qt::WaitCursor );

Q_FOREACH ( const QModelIndex &index, indexes )
{
QString symbolName = index.data().toString();
Expand All @@ -798,6 +800,8 @@ bool QgsStyleManagerDialog::removeColorRamp()
QMessageBox::No ) )
return false;

QgsTemporaryCursorOverride override( Qt::WaitCursor );

Q_FOREACH ( const QModelIndex &index, indexes )
{
QString rampName = index.data().toString();
Expand Down

0 comments on commit 8714e42

Please sign in to comment.