Class: QgsNewGeoPackageLayerDialog

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

Class Hierarchy

Inheritance diagram of qgis.gui.QgsNewGeoPackageLayerDialog

Base classes

QDialog

QWidget

QObject

QPaintDevice

Methods

databasePath

Returns the database path

lockDatabasePath

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

setAddToProject

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

setCrs

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

setDatabasePath

Sets the initial database path

setOverwriteBehavior

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

Attributes

AddNewLayer

Overwrite

Prompt

class qgis.gui.QgsNewGeoPackageLayerDialog[source]

Bases: QDialog

__init__(parent: QWidget | None = None, fl: Qt.WindowFlags | Qt.WindowType = QgsGuiUtils.ModalDialogFlags)

Constructor

Parameters:
  • parent (Optional[QWidget] = None)

  • fl (Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags)

AddNewLayer = 2
Overwrite = 1
class OverwriteBehavior

Bases: int

Prompt = 0
databasePath(self) str[source]

Returns the database path

Return type:

str

lockDatabasePath(self)[source]

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

setAddToProject(self, addToProject: bool)[source]

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

Added in version 3.6.

Parameters:

addToProject (bool)

setCrs(self, crs: QgsCoordinateReferenceSystem)[source]

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

Parameters:

crs (QgsCoordinateReferenceSystem)

setDatabasePath(self, path: str | None)[source]

Sets the initial database path

Parameters:

path (Optional[str])

setOverwriteBehavior(self, behavior: QgsNewGeoPackageLayerDialog.OverwriteBehavior)[source]

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.

Parameters:

behavior (QgsNewGeoPackageLayerDialog.OverwriteBehavior)