Skip to content
Permalink
Browse files

Use wait cursor during lengthy operations in style manager dialog

  • Loading branch information
nyalldawson committed Apr 17, 2018
1 parent 95c48f1 commit 8714e42612e4a1d71f8bf36e95e3700df9ef6fdc
Showing with 12 additions and 0 deletions.
  1. +8 −0 src/gui/symbology/qgsstyleexportimportdialog.cpp
  2. +4 −0 src/gui/symbology/qgsstylemanagerdialog.cpp
@@ -23,6 +23,7 @@
#include "qgscolorramp.h"
#include "qgslogger.h"
#include "qgsstylegroupselectiondialog.h"
#include "qgsguiutils.h"

#include <QInputDialog>
#include <QCloseEvent>
@@ -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
@@ -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;
@@ -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();
@@ -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();

0 comments on commit 8714e42

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