QgsNewGeoPackageLayerDialog class

Dialog to set up parameters to create a new GeoPackage layer, and on accept() to create it and add it to the layers.

Public types

enum OverwriteBehavior { Prompt, Overwrite, AddNewLayer }
Behavior to use when an existing geopackage already exists.

Constructors, destructors, conversion operators

QgsNewGeoPackageLayerDialog(QWidget* parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags)
Constructor.

Public functions

auto databasePath() const -> QString
Returns the database path.
void lockDatabasePath()
Sets the database path widgets to a locked and read-only mode.
void setAddToProject(bool addToProject)
Sets whether a newly created layer should automatically be added to the current project.
void setCrs(const QgsCoordinateReferenceSystem& crs)
Sets the crs value for the new layer in the dialog.
void setDatabasePath(const QString& path)
Sets the initial database path.
void setOverwriteBehavior(OverwriteBehavior behavior)
Sets the behavior to use when a path to an existing geopackage file is used.

Enum documentation

enum QgsNewGeoPackageLayerDialog::OverwriteBehavior

Behavior to use when an existing geopackage already exists.

Enumerators
Prompt

Prompt user for action.

Overwrite

Overwrite whole geopackage.

AddNewLayer

Keep existing contents and add new layer.

Function documentation

QString QgsNewGeoPackageLayerDialog::databasePath() const

Returns the database path.

void QgsNewGeoPackageLayerDialog::lockDatabasePath()

Sets the database path widgets to a locked and read-only mode.

void QgsNewGeoPackageLayerDialog::setAddToProject(bool addToProject)

Sets whether a newly created layer should automatically be added to the current project.

Defaults to true.

void QgsNewGeoPackageLayerDialog::setCrs(const QgsCoordinateReferenceSystem& crs)

Sets the crs value for the new layer in the dialog.

void QgsNewGeoPackageLayerDialog::setDatabasePath(const QString& path)

Sets the initial database path.

void QgsNewGeoPackageLayerDialog::setOverwriteBehavior(OverwriteBehavior behavior)

Sets the behavior to use when a path to an existing geopackage file is used.

The default behavior is to prompt the user for an action to take.