37 mProxyModel->setSourceModel( mSourceModel );
38 mMetadataTableView->setModel( mProxyModel );
39 mMetadataTableView->setSortingEnabled(
true );
40 mMetadataTableView->sortByColumn( 0, Qt::SortOrder::AscendingOrder );
41 mMetadataTableView->horizontalHeader()->setSectionResizeMode( QgsLayerMetadataResultsModel::Sections::Identifier, QHeaderView::ResizeMode::Stretch );
42 mMetadataTableView->horizontalHeader()->setSectionResizeMode( QgsLayerMetadataResultsModel::Sections::Title, QHeaderView::ResizeMode::Stretch );
43 mMetadataTableView->horizontalHeader()->setSectionResizeMode( QgsLayerMetadataResultsModel::Sections::Abstract, QHeaderView::ResizeMode::Stretch );
44 mMetadataTableView->horizontalHeader()->setSectionResizeMode( QgsLayerMetadataResultsModel::Sections::DataProviderName, QHeaderView::ResizeMode::ResizeToContents );
45 mMetadataTableView->horizontalHeader()->setSectionResizeMode( QgsLayerMetadataResultsModel::Sections::GeometryType, QHeaderView::ResizeMode::ResizeToContents );
46 mMetadataTableView->setSelectionBehavior( QAbstractItemView::SelectRows );
48 mExtentFilterComboBox->addItem( QString( ) );
49 mExtentFilterComboBox->addItem( QStringLiteral(
"Map Canvas Extent" ) );
50 mExtentFilterComboBox->addItem( QStringLiteral(
"Current Project Extent" ) );
51 mExtentFilterComboBox->setCurrentIndex( 0 );
52 mExtentFilterComboBox->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToContents );
53 mExtentFilterComboBox->adjustSize();
55 mGeometryTypeComboBox->addItem( QString( ), QVariant() );
62 mGeometryTypeComboBox->setCurrentIndex( 0 );
63 mGeometryTypeComboBox->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToContents );
64 mGeometryTypeComboBox->adjustSize();
66 auto updateLoadBtn = [ = ]
70 mAbortPushButton->setText( tr(
"Abort" ) );
75 mAbortPushButton->setText( tr(
"Refresh" ) );
91 connect( mAbortPushButton, &QPushButton::clicked, mSourceModel, [ = ](
bool )
101 mProgressBar->hide();
108 connect( mMetadataTableView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, [ = ](
const QItemSelection &,
const QItemSelection & )
110 emit enableButtons( mMetadataTableView->selectionModel()->hasSelection() );
117 connect( mGeometryTypeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ](
int index )
126 const QVariant geomTypeFilterValue( mGeometryTypeComboBox->currentData() );
127 if ( geomTypeFilterValue.isValid() )
162 if ( newMapCanvas &&
mapCanvas() != newMapCanvas )
180 else if ( index == 2 )
200 const QModelIndexList &selectedIndexes { mMetadataTableView->selectionModel()->selectedRows() };
201 if ( ! selectedIndexes.isEmpty() )
203 for (
const auto &selectedIndex : std::as_const( selectedIndexes ) )
206 switch ( metadataResult.layerType() )
210 emit
addRasterLayer( metadataResult.uri(), metadataResult.identifier(), metadataResult.dataProviderName() );
215 emit
addVectorLayer( metadataResult.uri(), metadataResult.identifier(), metadataResult.dataProviderName() );
220 emit
addMeshLayer( metadataResult.uri(), metadataResult.identifier(), metadataResult.dataProviderName() );
235 mSearchFilterLineEdit->clear();
236 mExtentFilterComboBox->setCurrentIndex( 0 );
241 QgsAbstractDataSourceWidget::showEvent( event );
242 mSearchFilterLineEdit->setText( mProxyModel->
filterString( ) );
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static Q_INVOKABLE QgsCoordinateReferenceSystem fromEpsgId(long epsg)
Creates a CRS from a given EPSG ID.
void cleared()
Emitted when the widget is cleared.
static QIcon iconForGeometryType(QgsWkbTypes::GeometryType typeGroup)
Returns the icon for a vector layer whose geometry typeGroup is provided.
Map canvas is a class for displaying all GIS data types on a canvas.
void extentsChanged()
Emitted when the extents of the map change.
QgsReferencedRectangle fullExtent() const
Returns the full extent of the project, which represents the maximal limits of the project.
void layersRemoved(const QStringList &layerIds)
Emitted after one or more layers were removed from the registry.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsCoordinateTransformContext transformContext
const QgsProjectViewSettings * viewSettings() const
Returns the project's view settings, which contains settings and properties relating to how a QgsProj...
void layersAdded(const QList< QgsMapLayer * > &layers)
Emitted when one or more layers were added to the registry.
WidgetMode
Different ways a source select dialog can be used.
A rectangle specified with double values.
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
A QgsRectangle with associated coordinate reference system.
static QString geometryDisplayString(GeometryType type) SIP_HOLDGIL
Returns a display string for a geometry type.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
@ MeshLayer
Mesh layer. Added in QGIS 3.2.
@ VectorLayer
Vector layer.
@ RasterLayer
Raster layer.
QgsCoordinateTransformContext transformContext
Coordinate transform context.