15 #include <QStringList> 25 : providerKey( layerItem->providerKey() )
26 , name( layerItem->layerName() )
27 , uri( layerItem->uri() )
28 , supportedCrs( layerItem->supportedCRS() )
29 , supportedFormats( layerItem->supportedFormats() )
48 QStringList decoded = decode( encData );
49 if ( decoded.size() < 4 )
57 if (
layerType ==
"raster" && decoded.size() == 6 )
68 QgsDebugMsg( QString(
"type:%1 key:%2 name:%3 uri:%4 supportedCRS:%5 supportedFormats:%6" )
88 QMimeData *mimeData =
new QMimeData();
89 QByteArray encodedData;
91 QDataStream stream( &encodedData, QIODevice::WriteOnly );
92 foreach (
const Uri& u, layers )
105 QDataStream stream( &encodedData, QIODevice::ReadOnly );
108 while ( !stream.atEnd() )
112 list.append(
Uri( xUri ) );
117 QString QgsMimeDataUtils::encode(
const QStringList& items )
120 foreach (
const QString& item, items )
123 str.replace(
"\\",
"\\\\" );
124 str.replace(
":",
"\\:" );
125 encoded += str +
":";
127 return encoded.left( encoded.length() - 1 );
130 QStringList QgsMimeDataUtils::decode(
const QString& encoded )
134 bool inEscape =
false;
135 foreach (
const QChar& c, encoded )
137 if ( c ==
'\\' && inEscape )
141 else if ( c ==
'\\' )
145 else if ( c ==
':' && !inEscape )
147 items.append( item );
156 items.append( item );
static UriList decodeUriList(const QMimeData *data)
QStringList supportedFormats
static bool isUriList(const QMimeData *data)
static QMimeData * encodeUriList(UriList layers)
QgsMapLayer::LayerType mapLayerType()
Item that represents a layer that can be opened with one of the providers.
static const char * QGIS_URILIST_MIMETYPE