Skip to content
Permalink
Browse files

Fix use of QWidgets from non-gui thread

  • Loading branch information
nyalldawson committed Dec 5, 2017
1 parent 2ca9054 commit eda3d6e4759a5a80d589311f9fb20509d029246b
@@ -24,40 +24,39 @@

///@cond NOT_STABLE

QgsProcessingAlgorithmDialogFeedback::QgsProcessingAlgorithmDialogFeedback( QgsProcessingAlgorithmDialogBase *dialog )
QgsProcessingAlgorithmDialogFeedback::QgsProcessingAlgorithmDialogFeedback()
: QgsProcessingFeedback()
, mDialog( dialog )
{
}

void QgsProcessingAlgorithmDialogFeedback::setProgressText( const QString &text )
{
mDialog->setProgressText( text );
emit progressTextChanged( text );
}

void QgsProcessingAlgorithmDialogFeedback::reportError( const QString &error )
{
mDialog->reportError( error );
emit errorReported( error );
}

void QgsProcessingAlgorithmDialogFeedback::pushInfo( const QString &info )
{
mDialog->pushInfo( info );
emit infoPushed( info );
}

void QgsProcessingAlgorithmDialogFeedback::pushCommandInfo( const QString &info )
{
mDialog->pushCommandInfo( info );
emit commandInfoPushed( info );
}

void QgsProcessingAlgorithmDialogFeedback::pushDebugInfo( const QString &info )
{
mDialog->pushDebugInfo( info );
emit debugInfoPushed( info );
}

void QgsProcessingAlgorithmDialogFeedback::pushConsoleInfo( const QString &info )
{
mDialog->pushConsoleInfo( info );
emit consoleInfoPushed( info );
}

//
@@ -158,8 +157,14 @@ QVariantMap QgsProcessingAlgorithmDialogBase::getParameterValues() const

QgsProcessingFeedback *QgsProcessingAlgorithmDialogBase::createFeedback()
{
auto feedback = qgis::make_unique< QgsProcessingAlgorithmDialogFeedback >( this );
auto feedback = qgis::make_unique< QgsProcessingAlgorithmDialogFeedback >();
connect( feedback.get(), &QgsProcessingFeedback::progressChanged, this, &QgsProcessingAlgorithmDialogBase::setPercentage );
connect( feedback.get(), &QgsProcessingAlgorithmDialogFeedback::commandInfoPushed, this, &QgsProcessingAlgorithmDialogBase::pushCommandInfo );
connect( feedback.get(), &QgsProcessingAlgorithmDialogFeedback::consoleInfoPushed, this, &QgsProcessingAlgorithmDialogBase::pushConsoleInfo );
connect( feedback.get(), &QgsProcessingAlgorithmDialogFeedback::debugInfoPushed, this, &QgsProcessingAlgorithmDialogBase::pushDebugInfo );
connect( feedback.get(), &QgsProcessingAlgorithmDialogFeedback::errorReported, this, &QgsProcessingAlgorithmDialogBase::reportError );
connect( feedback.get(), &QgsProcessingAlgorithmDialogFeedback::infoPushed, this, &QgsProcessingAlgorithmDialogBase::pushInfo );
connect( feedback.get(), &QgsProcessingAlgorithmDialogFeedback::progressTextChanged, this, &QgsProcessingAlgorithmDialogBase::setProgressText );
connect( buttonCancel, &QPushButton::clicked, feedback.get(), &QgsProcessingFeedback::cancel );
return feedback.release();
}
@@ -46,7 +46,16 @@ class QgsProcessingAlgorithmDialogFeedback : public QgsProcessingFeedback
/**
* Constructor for QgsProcessingAlgorithmDialogFeedback.
*/
QgsProcessingAlgorithmDialogFeedback( QgsProcessingAlgorithmDialogBase *dialog );
QgsProcessingAlgorithmDialogFeedback();

signals:

void progressTextChanged( const QString &text );
void errorReported( const QString &text );
void infoPushed( const QString &text );
void commandInfoPushed( const QString &text );
void debugInfoPushed( const QString &text );
void consoleInfoPushed( const QString &text );

public slots:

@@ -57,9 +66,6 @@ class QgsProcessingAlgorithmDialogFeedback : public QgsProcessingFeedback
void pushDebugInfo( const QString &info ) override;
void pushConsoleInfo( const QString &info ) override;

private:

QgsProcessingAlgorithmDialogBase *mDialog = nullptr;

};
#endif

0 comments on commit eda3d6e

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