Class: QgsNewVectorLayerDialog¶
A dialog for configuring the properties of a new vector layer.
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgsNewVectorLayerDialog[source]¶
Bases:
QDialog- __init__(parent: QWidget | None = None, fl: Qt.WindowFlags | Qt.WindowType = QgsGuiUtils.ModalDialogFlags)
New dialog constructor.
- Parameters:
parent (Optional[QWidget] = None)
fl (Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags)
- attributes(self, at: Iterable[Tuple[str | None, str | None]])[source]¶
Appends the chosen attribute names and types to at
- Parameters:
at (Iterable[Tuple[Optional[str], Optional[str]]])
- crs(self) QgsCoordinateReferenceSystem[source]¶
Returns the selected CRS for the new layer.
See also
- Return type:
- static execAndCreateLayer(parent: QWidget | None = None, initialPath: str | None = '', crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem())[source]¶
Runs the dialog and creates a layer matching the dialog parameters.
If the
initialPathargument is specified, then the dialog will default to the specified filename.Returns a filename if the dialog was accepted, or an empty string if the dialog was canceled. If the dialog was accepted but an error occurred while creating the file, then the function will return an empty string and
errorMessagewill contain the error message.If
encodingis specified, it will be set to the encoding of the created file.- Parameters:
parent (Optional[QWidget] = None) – parent widget for dialog
initialPath (Optional[str] = '') – initial file path to show in dialog
crs (
QgsCoordinateReferenceSystem= QgsCoordinateReferenceSystem()) -> (str) – default layer CRS to show in dialog
- Returns:
Newly created file name, or an empty string if user canceled or an error occurred.
errorMessage: any error message encountered during layer creation
encoding: file encoding of created layer
Added in version 3.4.5.
- static runAndCreateLayer(parent: QWidget | None = None, enc: str | None | None = '', crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem(), initialPath: str | None = '') str[source]¶
Runs the dialog and creates a layer matching the dialog parameters.
If the
initialPathargument is specified, then the dialog will default to the specified filename.- Return type:
str
- Returns:
fileName on success, empty string if aborted or creation failed
Deprecated since version 3.4.5: Use
execAndCreateLayer()instead.- Parameters:
parent (Optional[QWidget] = None)
enc (Optional[Optional[str]] = '')
crs (
QgsCoordinateReferenceSystem= QgsCoordinateReferenceSystem())initialPath (Optional[str] = '')
- selectedType(self) Qgis.WkbType[source]¶
Returns the selected geometry type
- Return type:
- setCrs(self, crs: QgsCoordinateReferenceSystem)[source]¶
Sets the
crsvalue for the new layer in the dialog.See also
- Parameters: