QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
Public Member Functions | Static Public Member Functions | List of all members
QgsNewVectorLayerDialog Class Reference

#include <qgsnewvectorlayerdialog.h>

Inheritance diagram for QgsNewVectorLayerDialog:
Inheritance graph
[legend]

Public Member Functions

 QgsNewVectorLayerDialog (QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
 New dialog constructor. More...
 
void attributes (QList< QPair< QString, QString > > &at) const
 Appends the chosen attribute names and types to at. More...
 
QgsCoordinateReferenceSystem crs () const
 Returns the selected CRS for the new layer. More...
 
QString filename () const
 Returns the name for the new layer. More...
 
QString selectedFileEncoding () const
 Returns the file format for storage. More...
 
QString selectedFileFormat () const
 Returns the file format for storage. More...
 
QgsWkbTypes::Type selectedType () const
 Returns the selected geometry type. More...
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the crs value for the new layer in the dialog. More...
 
void setFilename (const QString &filename)
 Sets the initial file name to show in the dialog. More...
 

Static Public Member Functions

static QString execAndCreateLayer (QString &errorMessage, QWidget *parent=nullptr, const QString &initialPath=QString(), QString *encoding=nullptr, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Runs the dialog and creates a layer matching the dialog parameters. More...
 
static Q_DECL_DEPRECATED QString runAndCreateLayer (QWidget *parent=nullptr, QString *enc=nullptr, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), const QString &initialPath=QString())
 Runs the dialog and creates a layer matching the dialog parameters. More...
 

Detailed Description

Definition at line 32 of file qgsnewvectorlayerdialog.h.

Constructor & Destructor Documentation

◆ QgsNewVectorLayerDialog()

QgsNewVectorLayerDialog::QgsNewVectorLayerDialog ( QWidget *  parent = nullptr,
Qt::WindowFlags  fl = QgsGuiUtils::ModalDialogFlags 
)

New dialog constructor.

Definition at line 36 of file qgsnewvectorlayerdialog.cpp.

Member Function Documentation

◆ attributes()

void QgsNewVectorLayerDialog::attributes ( QList< QPair< QString, QString > > &  at) const

Appends the chosen attribute names and types to at.

Definition at line 204 of file qgsnewvectorlayerdialog.cpp.

◆ crs()

QgsCoordinateReferenceSystem QgsNewVectorLayerDialog::crs ( ) const

Returns the selected CRS for the new layer.

See also
setCrs()

Definition at line 176 of file qgsnewvectorlayerdialog.cpp.

◆ execAndCreateLayer()

QString QgsNewVectorLayerDialog::execAndCreateLayer ( QString &  errorMessage,
QWidget *  parent = nullptr,
const QString &  initialPath = QString(),
QString *  encoding = nullptr,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem() 
)
static

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
errorMessagewill be set to any error message encountered during layer creation
parentparent widget for dialog
initialPathinitial file path to show in dialog
encodingif specified, will be set to file encoding of created layer
crsdefault layer CRS to show in dialog
Returns
Newly created file name, or an empty string if user canceled or an error occurred.
Since
QGIS 3.4.5

Definition at line 265 of file qgsnewvectorlayerdialog.cpp.

◆ filename()

QString QgsNewVectorLayerDialog::filename ( ) const

Returns the name for the new layer.

See also
setFilename()

Definition at line 239 of file qgsnewvectorlayerdialog.cpp.

◆ runAndCreateLayer()

QString QgsNewVectorLayerDialog::runAndCreateLayer ( QWidget *  parent = nullptr,
QString *  enc = nullptr,
const QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem(),
const QString &  initialPath = QString() 
)
static

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
fileName on success, empty string use aborted, QString() if creation failed
Deprecated:
since QGIS 3.4.5 - use execAndCreateLayer() instead.

Definition at line 256 of file qgsnewvectorlayerdialog.cpp.

◆ selectedFileEncoding()

QString QgsNewVectorLayerDialog::selectedFileEncoding ( ) const

Returns the file format for storage.

Definition at line 224 of file qgsnewvectorlayerdialog.cpp.

◆ selectedFileFormat()

QString QgsNewVectorLayerDialog::selectedFileFormat ( ) const

Returns the file format for storage.

Definition at line 217 of file qgsnewvectorlayerdialog.cpp.

◆ selectedType()

QgsWkbTypes::Type QgsNewVectorLayerDialog::selectedType ( ) const

Returns the selected geometry type.

Definition at line 161 of file qgsnewvectorlayerdialog.cpp.

◆ setCrs()

void QgsNewVectorLayerDialog::setCrs ( const QgsCoordinateReferenceSystem crs)

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

See also
crs()
Since
QGIS 3.0

Definition at line 181 of file qgsnewvectorlayerdialog.cpp.

◆ setFilename()

void QgsNewVectorLayerDialog::setFilename ( const QString &  filename)

Sets the initial file name to show in the dialog.

See also
filename()
Since
QGIS 3.6

Definition at line 244 of file qgsnewvectorlayerdialog.cpp.


The documentation for this class was generated from the following files: