Class: QgsNewVectorLayerDialog

class qgis.gui.QgsNewVectorLayerDialog(parent: QWidget = None, fl: Qt.WindowFlags | Qt.WindowType = QgsGuiUtils.ModalDialogFlags)

Bases: PyQt5.QtWidgets.QDialog

New dialog constructor.

Methods

accept

actionEvent

attributes

Appends the chosen attribute names and types to at

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

crs

Returns the selected CRS for the new layer.

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

eventFilter

execAndCreateLayer

Runs the dialog and creates a layer matching the dialog parameters.

filename

Returns the name for the new layer

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

runAndCreateLayer

Runs the dialog and creates a layer matching the dialog parameters.

selectedFileEncoding

Returns the file format for storage

selectedFileFormat

Returns the file format for storage

selectedType

Returns the selected geometry type

sender

senderSignalIndex

setCrs

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

setFilename

Sets the initial file name to show in the dialog.

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

accept(self)
actionEvent(self, QActionEvent)
attributes(self, at: Iterable[Tuple[str, str]])

Appends the chosen attribute names and types to at

Parameters:

at (Iterable[Tuple[str) –

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
crs(self) QgsCoordinateReferenceSystem

Returns the selected CRS for the new layer.

See also

setCrs()

Return type:

QgsCoordinateReferenceSystem

customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
execAndCreateLayer(parent: QWidget = None, initialPath: str = '', crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) Tuple[str, str, str]

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 (QWidget = None) – parent widget for dialog

  • initialPath (str = '') – initial file path to show in dialog

  • crs (QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) – default layer CRS to show in dialog

Return type:

Tuple[str, str, str]

Returns:

  • Newly created file name, or an empty string if user canceled or an error occurred.

  • errorMessage: will be set to any error message encountered during layer creation

  • encoding: will be set to file encoding of created layer

New in version 3.4.5.

filename(self) str

Returns the name for the new layer

See also

setFilename()

Return type:

str

focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
runAndCreateLayer(parent: QWidget = None, enc: str = '', crs: QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem(), initialPath: str = '') str

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 QGIS: 3.4.5 - use execAndCreateLayer() instead.

Parameters:
  • parent (QWidget = None) –

  • enc (str = '') –

  • crs (QgsCoordinateReferenceSystem = QgsCoordinateReferenceSystem()) –

  • initialPath (str = '') –

selectedFileEncoding(self) str

Returns the file format for storage

Return type:

str

selectedFileFormat(self) str

Returns the file format for storage

Return type:

str

selectedType(self) Qgis.WkbType

Returns the selected geometry type

Return type:

Qgis.WkbType

sender(self) QObject
senderSignalIndex(self) int
setCrs(self, crs: QgsCoordinateReferenceSystem)

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

See also

crs()

Parameters:

crs (QgsCoordinateReferenceSystem) –

setFilename(self, filename: str)

Sets the initial file name to show in the dialog.

See also

filename()

New in version 3.6.

Parameters:

filename (str) –

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)