28      return QStringLiteral( 
"integer" );
 
   30    case QVariant::LongLong:
 
   31      return QStringLiteral( 
"long" );
 
   33    case QVariant::Double:
 
   34      return QStringLiteral( 
"double" );
 
   36    case QVariant::String:
 
   37      return QStringLiteral( 
"string" );
 
   40      return QStringLiteral( 
"date" );
 
   43      return QStringLiteral( 
"time" );
 
   45    case QVariant::DateTime:
 
   46      return QStringLiteral( 
"datetime" );
 
   48    case QVariant::ByteArray:
 
   49      return QStringLiteral( 
"binary" );
 
   52      return QStringLiteral( 
"boolean" );
 
   55      return QStringLiteral( 
"map" );
 
   57    case QVariant::UserType:
 
   58      if ( typeString.compare( QLatin1String( 
"geometry" ), Qt::CaseInsensitive ) == 0 )
 
   60        return QStringLiteral( 
"geometry" );
 
   67  return QStringLiteral( 
"string" );
 
   73  if ( geomType.isNull() )
 
   74    geomType = QStringLiteral( 
"none" );
 
   80      parts << QStringLiteral( 
"crs=%1" ).arg( 
crs.
authid() );
 
   86    parts << QStringLiteral( 
"crs=" );
 
   91    parts << QStringLiteral( 
"field=%1:%2%3%4" ).arg( QString( QUrl::toPercentEncoding( 
field.
name() ) ),
 
   94          field.
type() == QVariant::List || 
field.
type() == QVariant::StringList ? QStringLiteral( 
"[]" ) : QString() );
 
   97  const QString uri = geomType + 
'?' + parts.join( 
'&' );
 
   99  options.skipCrsValidation = 
true;
 
  100  options.loadDefaultStyle = loadDefaultStyle;
 
  101  return new QgsVectorLayer( uri, name, QStringLiteral( 
"memory" ), options );
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
This class represents a coordinate reference system (CRS).
 
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
 
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
 
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
 
Contains information about the context in which a coordinate transform is executed.
 
Encapsulate a field in an attribute table or data source.
 
QString typeName() const
Gets the field type.
 
QVariant::Type subType() const
If the field is a collection, gets its element's type.
 
Container of fields for a vector layer.
 
static QgsVectorLayer * createMemoryLayer(const QString &name, const QgsFields &fields, Qgis::WkbType geometryType=Qgis::WkbType::NoGeometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), bool loadDefaultStyle=true) SIP_FACTORY
Creates a new memory layer using the specified parameters.
 
Represents a vector layer which manages a vector based data sets.
 
static QString displayString(Qgis::WkbType type) SIP_HOLDGIL
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
 
QString memoryLayerFieldType(QVariant::Type type, const QString &typeString)
 
const QgsCoordinateReferenceSystem & crs
 
Setting options for loading vector layers.