15 #include <QStringList>
25 : providerKey( layerItem->providerKey() )
26 , name( layerItem->layerName() )
27 , uri( layerItem->uri() )
28 , supportedCrs( layerItem->supportedCRS() )
29 , supportedFormats( layerItem->supportedFormats() )
49 if ( decoded.
size() < 4 )
52 layerType = decoded[0];
53 providerKey = decoded[1];
57 if ( layerType ==
"raster" && decoded.
size() == 6 )
59 supportedCrs = decode( decoded[4] );
60 supportedFormats = decode( decoded[5] );
65 supportedFormats.clear();
68 QgsDebugMsg(
QString(
"type:%1 key:%2 name:%3 uri:%4 supportedCRS:%5 supportedFormats:%6" )
69 .arg( layerType, providerKey, name, uri,
70 supportedCrs.join(
", " ),
71 supportedFormats.join(
", " ) ) );
76 return encode(
QStringList() << layerType << providerKey << name << uri << encode( supportedCrs ) << encode( supportedFormats ) );
91 QDataStream stream( &encodedData, QIODevice::WriteOnly );
92 Q_FOREACH (
const Uri& u, layers )
105 QDataStream stream( &encodedData, QIODevice::ReadOnly );
108 while ( !stream.
atEnd() )
120 Q_FOREACH (
const QString& item, items )
125 encoded += str +
":";
134 bool inEscape =
false;
135 Q_FOREACH (
const QChar& c, encoded )
137 if ( c ==
'\\' && inEscape )
141 else if ( c ==
'\\' )
145 else if ( c ==
':' && !inEscape )
QByteArray data(const QString &mimeType) const
static UriList decodeUriList(const QMimeData *data)
static QMimeData * encodeUriList(const UriList &layers)
static bool isUriList(const QMimeData *data)
void append(const T &value)
QString & replace(int position, int n, QChar after)
QgsMapLayer::LayerType mapLayerType()
Returns QgsMapLayer::LayerType.
QString left(int n) const
Item that represents a layer that can be opened with one of the providers.
void setData(const QString &mimeType, const QByteArray &data)
static const char * QGIS_URILIST_MIMETYPE