QGIS/python/core/auto_generated/qgsmimedatautils.sip.in
2024-08-16 07:28:29 +10:00

144 lines
4.0 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmimedatautils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsMimeDataUtils
{
%Docstring(signature="appended")
Contains utility functions for working with MIME data.
%End
%TypeHeaderCode
#include "qgsmimedatautils.h"
%End
public:
struct Uri
{
Uri();
%Docstring
Constructs invalid URI
%End
explicit Uri( const QString &encData );
%Docstring
Constructs URI from encoded data
%End
explicit Uri( QgsMapLayer *layer );
%Docstring
Constructs a URI corresponding to the specified ``layer``.
.. versionadded:: 3.8
%End
bool isValid() const;
%Docstring
Returns whether the object contains valid data
%End
QString data() const;
%Docstring
Returns encoded representation of the object
%End
QgsVectorLayer *vectorLayer( bool &owner, QString &error ) const;
%Docstring
Gets vector layer from uri if possible, otherwise returns ``None`` and error is set
:param owner: set to ``True`` if caller becomes owner
:param error: set to error message if cannot get vector
%End
QgsRasterLayer *rasterLayer( bool &owner, QString &error ) const;
%Docstring
Gets raster layer from uri if possible, otherwise returns ``None`` and error is set
:param owner: set to ``True`` if caller becomes owner
:param error: set to error message if cannot get raster
%End
QgsMeshLayer *meshLayer( bool &owner, QString &error ) const;
%Docstring
Gets mesh layer from uri if possible, otherwise returns ``None`` and error is set
:param owner: set to ``True`` if caller becomes owner
:param error: set to error message if cannot get raster
%End
QgsMapLayer *mapLayer() const;
%Docstring
Returns the layer from the active project corresponding to this uri (if possible),
otherwise returns ``None``.
Unlike :py:func:`~QgsMimeDataUtils.vectorLayer`, :py:func:`~QgsMimeDataUtils.rasterLayer`, or :py:func:`~QgsMimeDataUtils.meshLayer`, this method will not attempt
to create a new layer corresponding to the URI.
.. versionadded:: 3.8
%End
QString layerType;
QString providerKey;
QString name;
QString uri;
QStringList supportedCrs;
QStringList supportedFormats;
QString layerId;
QString pId;
Qgis::WkbType wkbType;
QString filePath;
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsMimeDataUtils::Uri (%1): %2>" ).arg( sipCpp->providerKey, sipCpp->uri );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};
typedef QList<QgsMimeDataUtils::Uri> UriList;
static QMimeData *encodeUriList( const UriList &layers ) /Factory/;
%Docstring
Encodes a URI list to a new QMimeData object.
%End
static bool isUriList( const QMimeData *data );
static UriList decodeUriList( const QMimeData *data );
static QByteArray layerTreeNodesToUriList( const QList<QgsLayerTreeNode *> &nodes );
%Docstring
Returns encoded URI list from a list of layer tree nodes.
%End
static bool hasOriginatedFromCurrentAppInstance( const QgsMimeDataUtils::Uri &uri );
%Docstring
Returns ``True`` if ``uri`` originated from the current QGIS application
instance.
.. versionadded:: 3.8
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmimedatautils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/