Class: QgsMimeDataUtils

class qgis.core.QgsMimeDataUtils

Bases: sip.wrapper

QgsMimeDataUtils(QgsMimeDataUtils)

Enums

Methods

decodeUriList

encodeUriList

Encodes a URI list to a new QMimeData object.

hasOriginatedFromCurrentAppInstance

Returns True if uri originated from the current QGIS application instance.

isUriList

layerTreeNodesToUriList

Returns encoded URI list from a list of layer tree nodes.

Signals

Attributes

class Uri

Bases: sip.wrapper

Constructs invalid URI

QgsMimeDataUtils.Uri(encData: str) Constructs URI from encoded data

QgsMimeDataUtils.Uri(layer: QgsMapLayer) Constructs a URI corresponding to the specified layer.

New in version 3.8.

QgsMimeDataUtils.Uri(QgsMimeDataUtils.Uri)

data(self) → str

Returns encoded representation of the object

isValid(self) → bool

Returns whether the object contains valid data

New in version 3.0.

layerId
layerType
mapLayer(self) → QgsMapLayer

Returns the layer from the active project corresponding to this uri (if possible), otherwise returns None.

Unlike vectorLayer(), rasterLayer(), or meshLayer(), this method will not attempt to create a new layer corresponding to the URI.

New in version 3.8.

meshLayer(self, error: str) → Tuple[QgsMeshLayer, bool]

Gets mesh layer from uri if possible, otherwise returns None and error is set

Parameters
  • owner – set to True if caller becomes owner

  • error – set to error message if cannot get raster

name
pId
providerKey
rasterLayer(self, error: str) → Tuple[QgsRasterLayer, bool]

Gets raster layer from uri if possible, otherwise returns None and error is set

Parameters
  • owner – set to True if caller becomes owner

  • error – set to error message if cannot get raster

supportedCrs
supportedFormats
uri
vectorLayer(self, error: str) → Tuple[QgsVectorLayer, bool]

Gets vector layer from uri if possible, otherwise returns None and error is set

Parameters
  • owner – set to True if caller becomes owner

  • error – set to error message if cannot get vector

wkbType
decodeUriList(data: QMimeData) → List[QgsMimeDataUtils.Uri]
encodeUriList(layers: Iterable[QgsMimeDataUtils.Uri]) → QMimeData

Encodes a URI list to a new QMimeData object.

hasOriginatedFromCurrentAppInstance(uri: QgsMimeDataUtils.Uri) → bool

Returns True if uri originated from the current QGIS application instance.

New in version 3.8.

isUriList(data: QMimeData) → bool
layerTreeNodesToUriList(nodes: Iterable[QgsLayerTreeNode]) → QByteArray

Returns encoded URI list from a list of layer tree nodes.

New in version 3.0.