Class: QgsMimeDataUtils¶
- class qgis.core.QgsMimeDataUtils¶
- class qgis.core.QgsMimeDataUtils(QgsMimeDataUtils)
Bases:
sip.wrapper
Methods
- param data
Encodes a URI list to a new QMimeData object.
Returns
True
ifuri
originated from the current QGIS application instance.- param data
Returns encoded URI list from a list of layer tree nodes.
- 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 specifiedlayer
.New in version 3.8.
QgsMimeDataUtils.Uri(QgsMimeDataUtils.Uri)
- data(self) str ¶
Returns encoded representation of the object
- Return type
str
- filePath¶
- isValid(self) bool ¶
Returns whether the object contains valid data
New in version 3.0.
- Return type
bool
- layerId¶
- layerType¶
- mapLayer(self) QgsMapLayer ¶
Returns the layer from the active project corresponding to this uri (if possible), otherwise returns
None
.Unlike
vectorLayer()
,rasterLayer()
, ormeshLayer()
, this method will not attempt to create a new layer corresponding to the URI.New in version 3.8.
- Return type
- 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 ownererror (str) – set to error message if cannot get raster
- Return type
Tuple[
QgsMeshLayer
, bool]
- 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 ownererror (str) – set to error message if cannot get raster
- Return type
Tuple[
QgsRasterLayer
, bool]
- 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 ownererror (str) – set to error message if cannot get vector
- Return type
Tuple[
QgsVectorLayer
, bool]
- wkbType¶
- decodeUriList(data: QMimeData) List[QgsMimeDataUtils.Uri] ¶
- Parameters
data (QMimeData) –
- Return type
List[QgsMimeDataUtils.Uri]
- encodeUriList(layers: Iterable[QgsMimeDataUtils.Uri]) QMimeData ¶
Encodes a URI list to a new QMimeData object.
- Parameters
layers (Iterable[QgsMimeDataUtils.Uri]) –
- Return type
QMimeData
- hasOriginatedFromCurrentAppInstance(uri: QgsMimeDataUtils.Uri) bool ¶
Returns
True
ifuri
originated from the current QGIS application instance.New in version 3.8.
- Parameters
uri (QgsMimeDataUtils.Uri) –
- Return type
bool
- isUriList(data: QMimeData) bool ¶
- Parameters
data (QMimeData) –
- Return type
bool
- layerTreeNodesToUriList(nodes: Iterable[QgsLayerTreeNode]) QByteArray ¶
Returns encoded URI list from a list of layer tree nodes.
New in version 3.0.
- Parameters
nodes (Iterable[QgsLayerTreeNode]) –
- Return type
QByteArray