Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gui] Lazy load layer metadata in datasource manager #60319

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/gui/qgslayermetadatasearchwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ QgsLayerMetadataSearchWidget::QgsLayerMetadataSearchWidget( QWidget *parent, Qt:
} );

connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsLayerMetadataSearchWidget::showHelp );

// Start loading metadata in the model
mSourceModel->reloadAsync();
mIsLoading = true;
}

void QgsLayerMetadataSearchWidget::setMapCanvas( QgsMapCanvas *newMapCanvas )
Expand Down Expand Up @@ -185,6 +181,7 @@ void QgsLayerMetadataSearchWidget::updateExtentFilter( int index )

void QgsLayerMetadataSearchWidget::refresh()
{
mIsLoading = true;
mSourceModel->reloadAsync();
}

Expand Down Expand Up @@ -261,6 +258,12 @@ void QgsLayerMetadataSearchWidget::showEvent( QShowEvent *event )
{
QgsAbstractDataSourceWidget::showEvent( event );
mSearchFilterLineEdit->setText( mProxyModel->filterString() );
// The first show event triggers the metadata loading
if ( !mIsInitialized )
{
refresh();
mIsInitialized = true;
}
}

void QgsLayerMetadataSearchWidget::showHelp()
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgslayermetadatasearchwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class GUI_EXPORT QgsLayerMetadataSearchWidget : public QgsAbstractDataSourceWidg
private:
QgsLayerMetadataResultsProxyModel *mProxyModel = nullptr;
bool mIsLoading = false;
bool mIsInitialized = false;
QgsLayerMetadataResultsModel *mSourceModel = nullptr;

// QWidget interface
Expand Down
Loading