2012-09-24 02:28:15 +02:00
|
|
|
class QgsMimeDataUtils
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsmimedatautils.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
struct Uri
|
|
|
|
{
|
2016-08-09 08:49:42 +02:00
|
|
|
//! Constructs invalid URI
|
|
|
|
Uri();
|
|
|
|
//! Constructs URI from encoded data
|
|
|
|
explicit Uri( QString& encData );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-09 08:49:42 +02:00
|
|
|
//! Returns whether the object contains valid data
|
|
|
|
//! @note added in 3.0
|
|
|
|
bool isValid() const;
|
|
|
|
|
|
|
|
//! Returns encoded representation of the object
|
2012-09-24 02:28:15 +02:00
|
|
|
QString data() const;
|
|
|
|
|
2016-08-09 08:49:42 +02:00
|
|
|
//! Type of URI. Recognized types: "vector" / "raster" / "plugin" / "custom"
|
2012-09-24 02:28:15 +02:00
|
|
|
QString layerType;
|
2016-08-09 08:49:42 +02:00
|
|
|
//! For "vector" / "raster" type: provider id.
|
|
|
|
//! For "plugin" type: plugin layer type name.
|
|
|
|
//! For "custom" type: key of its QgsCustomDropHandler
|
2012-09-24 02:28:15 +02:00
|
|
|
QString providerKey;
|
2016-08-09 08:49:42 +02:00
|
|
|
//! Human readable name to be used e.g. in layer tree
|
2012-09-24 02:28:15 +02:00
|
|
|
QString name;
|
2016-08-09 08:49:42 +02:00
|
|
|
//! Identifier of the data source recognized by its providerKey
|
2012-09-24 02:28:15 +02:00
|
|
|
QString uri;
|
2015-02-03 02:21:52 +01:00
|
|
|
QStringList supportedCrs;
|
|
|
|
QStringList supportedFormats;
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
|
|
|
typedef QList<QgsMimeDataUtils::Uri> UriList;
|
|
|
|
|
2015-10-07 11:55:34 +11:00
|
|
|
static QMimeData* encodeUriList( const UriList& layers );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
static bool isUriList( const QMimeData* data );
|
|
|
|
|
|
|
|
static UriList decodeUriList( const QMimeData* data );
|
|
|
|
|
2016-08-21 13:24:07 +02:00
|
|
|
/**
|
|
|
|
* Returns encoded URI list from a list of layer tree nodes.
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
static QByteArray layerTreeNodesToUriList( const QList<QgsLayerTreeNode*>& nodes );
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|