mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
add option to only include selected features when importing
This commit is contained in:
parent
d0bf82eee3
commit
a152d680b1
@ -234,6 +234,9 @@ void QgsDbImportVectorLayerDialog::setSourceLayer( QgsVectorLayer *layer )
|
||||
mFieldsView->setSourceLayer( mSourceLayer );
|
||||
mFieldsView->setSourceFields( mSourceLayer->fields() );
|
||||
mFieldsView->setDestinationFields( mSourceLayer->fields() );
|
||||
|
||||
const bool selectedFeatures = mSourceLayer->selectedFeatureCount() > 0;
|
||||
mSourceLayerOnlySelected->setEnabled( selectedFeatures );
|
||||
}
|
||||
|
||||
void QgsDbImportVectorLayerDialog::loadFieldsFromLayer()
|
||||
@ -352,6 +355,11 @@ std::unique_ptr<QgsVectorLayerExporterTask> QgsDbImportVectorLayerDialog::create
|
||||
exportOptions.setExtent( QgsReferencedRectangle( mExtentGroupBox->outputExtent(), mExtentGroupBox->outputCrs() ) );
|
||||
}
|
||||
|
||||
if ( mSourceLayerOnlySelected->isEnabled() && mSourceLayerOnlySelected->isChecked() )
|
||||
{
|
||||
exportOptions.setSelectedOnly( true );
|
||||
}
|
||||
|
||||
const QList<QgsFieldMappingModel::Field> fieldMapping = mFieldsView->mapping();
|
||||
QList<QgsVectorLayerExporter::OutputField> outputFields;
|
||||
outputFields.reserve( fieldMapping.size() );
|
||||
|
@ -41,6 +41,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="mSourceLayerOnlySelected">
|
||||
<property name="text">
|
||||
<string>Selected features only</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user