mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Progress task on project load
This commit is contained in:
parent
37f3be60b2
commit
5d078ec222
@ -257,6 +257,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
|
||||
#include "qgsprojectstorageregistry.h"
|
||||
#include "qgsproviderregistry.h"
|
||||
#include "qgspythonrunner.h"
|
||||
#include "qgsproxyprogresstask.h"
|
||||
#include "qgsquerybuilder.h"
|
||||
#include "qgsrastercalcdialog.h"
|
||||
#include "qgsrasterfilewriter.h"
|
||||
@ -3378,7 +3379,22 @@ void QgisApp::setupConnections()
|
||||
connect( QgsProject::instance(), &QgsProject::oldProjectVersionWarning,
|
||||
this, &QgisApp::oldProjectVersionWarning );
|
||||
connect( QgsProject::instance(), &QgsProject::layerLoaded,
|
||||
this, &QgisApp::showProgress );
|
||||
this, [this]( int i, int n )
|
||||
{
|
||||
if ( !mProjectLoadingProxyTask )
|
||||
{
|
||||
const QString name = QgsProject::instance()->title().isEmpty() ? QgsProject::instance()->fileName() : QgsProject::instance()->title();
|
||||
mProjectLoadingProxyTask = new QgsProxyProgressTask( tr( "Loading “%1”" ).arg( name ) );
|
||||
QgsApplication::taskManager()->addTask( mProjectLoadingProxyTask );
|
||||
}
|
||||
|
||||
mProjectLoadingProxyTask->setProxyProgress( 100.0 * static_cast< double >( i ) / n );
|
||||
if ( i == n )
|
||||
{
|
||||
mProjectLoadingProxyTask->finalize( true );
|
||||
mProjectLoadingProxyTask = nullptr;
|
||||
}
|
||||
} );
|
||||
connect( QgsProject::instance(), &QgsProject::loadingLayer,
|
||||
this, &QgisApp::showStatusMessage );
|
||||
connect( QgsProject::instance(), &QgsProject::loadingLayerMessageReceived,
|
||||
|
@ -133,7 +133,7 @@ class QgsDataSourceManagerDialog;
|
||||
class QgsBrowserModel;
|
||||
class QgsGeoCmsProviderRegistry;
|
||||
class QgsLayoutQptDropHandler;
|
||||
|
||||
class QgsProxyProgressTask;
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QToolBar>
|
||||
@ -2283,6 +2283,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
QMap< QString, QString > mProjectPropertiesPagesMap;
|
||||
QMap< QString, QString > mSettingPagesMap;
|
||||
|
||||
QgsProxyProgressTask *mProjectLoadingProxyTask = nullptr;
|
||||
|
||||
friend class TestQgisAppPython;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user