Class: QgsNewVectorLayerDialog¶
Class Hierarchy¶
Base classes¶
Methods
Appends the chosen attribute names and types to at |
|
Returns the selected CRS for the new layer. |
|
Returns the name for the new layer |
|
Returns the file format for storage |
|
Returns the file format for storage |
|
Returns the selected geometry type |
|
Sets the crs value for the new layer in the dialog. |
|
Sets the initial file name to show in the dialog. |
Static Methods
Runs the dialog and creates a layer matching the dialog parameters. |
|
Runs the dialog and creates a layer matching the dialog parameters. |
- class qgis.gui.QgsNewVectorLayerDialog(parent: QWidget | None = None, fl: Qt.WindowFlags | Qt.WindowType = QgsGuiUtils.ModalDialogFlags)[source]¶
Bases:
QDialog
- 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
initialPath
argument 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
errorMessage
will contain the error message.If
encoding
is 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
initialPath
argument is specified, then the dialog will default to the specified filename.- Return type:
str
- Returns:
fileName on success, empty string use aborted, QString() if 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
crs
value for the new layer in the dialog.See also
- Parameters: