本文整理汇总了C++中QUrl::setQueryItems方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::setQueryItems方法的具体用法?C++ QUrl::setQueryItems怎么用?C++ QUrl::setQueryItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::setQueryItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doSearchJourney
void ParserResRobot::doSearchJourney(QUrl query)
#endif
{
QUrl url = baseURL + QLatin1String("/trip");
if (lastJourneySearch.mode == Arrival)
query.addQueryItem("searchForArrival", "1");
query.addQueryItem("key", journeyAPIKey);
query.addQueryItem("originId", lastJourneySearch.from.id.toString());
if (lastJourneySearch.via.valid)
query.addQueryItem("viaId", lastJourneySearch.via.id.toString());
query.addQueryItem("destId", lastJourneySearch.to.id.toString());
query.addQueryItem("passlist", "0"); // We don't need any intermediate stops in the result
query.addQueryItem("format", "json");
QString formattedRestrictions(formatRestrictions(lastJourneySearch.restrictions));
if (!formattedRestrictions.isEmpty())
query.addQueryItem("products", formattedRestrictions);
if (QLocale().language() == QLocale::Swedish)
query.addQueryItem("lang", "sv");
else if (QLocale().language() == QLocale::German)
query.addQueryItem("lang", "de");
else
query.addQueryItem("lang", "en");
#if defined(BUILD_FOR_QT5)
url.setQuery(query);
#else
url.setQueryItems(query.queryItems());
#endif
qDebug() << "Searching for journey:" << url.toString();
sendHttpRequest(url);
}
示例2: sendRequest
void Remote::sendRequest(std::string requestStr,
ParamsList const & params) {
QNetworkRequest request;
QUrl newUrl = _naoUrl;
newUrl.setPath(requestStr.c_str());
if (!params.empty()) {
newUrl.setQueryItems(params);
}
_pendingRequest << newUrl;
}
示例3: start
void JsonApiJob::start()
{
QNetworkRequest req;
req.setRawHeader("OCS-APIREQUEST", "true");
QUrl url = Account::concatUrlPath(account()->url(), path());
url.setQueryItems(QList<QPair<QString, QString> >() << qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json")));
setReply(davRequest("GET", url, req));
setupConnections(reply());
AbstractNetworkJob::start();
}
示例4: getTimeTableForStation
void ParserResRobot::getTimeTableForStation(const Station ¤tStation,
const Station &directionStation,
const QDateTime &dateTime,
ParserAbstract::Mode mode,
int trainrestrictions)
{
if (currentRequestState != FahrplanNS::noneRequest)
return;
currentRequestState = FahrplanNS::getTimeTableForStationRequest;
timetableSearchMode = mode;
QUrl url;
if (mode == Arrival)
url.setUrl(baseURL + QLatin1String("/arrivalBoard"));
else
url.setUrl(baseURL + QLatin1String("/departureBoard"));
#if defined(BUILD_FOR_QT5)
QUrlQuery query;
#else
QUrl query;
#endif
query.addQueryItem("key", timetableAPIKey);
query.addQueryItem("id", stationIDv2(currentStation.id.toString()));
if (directionStation.valid)
query.addQueryItem("direction", stationIDv2(directionStation.id.toString()));
query.addQueryItem("date", dateTime.toString("yyyy-MM-dd"));
query.addQueryItem("time", dateTime.toString("hh:mm"));
query.addQueryItem("maxJourneys", "30"); // Max number of results
query.addQueryItem("passlist", "0"); // We don't need any intermediate stops in the result
QString formattedRestrictions(formatRestrictions(trainrestrictions));
if (!formattedRestrictions.isEmpty())
query.addQueryItem("products", formattedRestrictions);
if (QLocale().language() == QLocale::Swedish)
query.addQueryItem("lang", "sv");
else if (QLocale().language() == QLocale::German)
query.addQueryItem("lang", "de");
else
query.addQueryItem("lang", "en");
query.addQueryItem("format", "json");
#if defined(BUILD_FOR_QT5)
url.setQuery(query);
#else
url.setQueryItems(query.queryItems());
#endif
qDebug() << "Searching for timetable:" << url.toString();
sendHttpRequest(url);
}
示例5: convertData
QByteArray Http::convertData(QMap<QString, QString> data)
{
QString key;
QString value;
QUrl url;
QList<QPair<QString, QString> > list;
QMap<QString, QString>::const_iterator i = data.constBegin();
while(i != data.constEnd()) {
key = i.key();
value = i.value();
list.append(QPair<QString,QString>(key,value));
i++;
}
url.setQueryItems(list);
return url.encodedQuery() ;
}
示例6: setQueryItems
void QUrlProto::setQueryItems(const QVariantMap &map)
{
if (DEBUG) qDebug("setQueryItems(const QVariantMap &map) entered");
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
{
QList<QPair<QString, QString> > query;
QMapIterator<QString, QVariant> i(map);
while (i.hasNext())
{
i.next();
query.append(qMakePair(i.key(), i.value().toString()));
}
item->setQueryItems(query);
}
}
示例7: AbstractDownloadReply
DownloadFaviconReply::DownloadFaviconReply(
const DownloadFaviconRequest &request,
QNetworkAccessManager *network, QObject *parent) :
AbstractDownloadReply(network, parent)
{
m_request = request;
QUrl favIconUrl = request.url();
favIconUrl.setPath("/favicon.ico");
favIconUrl.setFragment(QString());
#if QT_VERSION >= 0x050000
favIconUrl.setQuery(QUrlQuery());
#else
favIconUrl.setQueryItems(QList<QPair<QString, QString> >());
#endif
fetchUrl(favIconUrl,
request.maxRetryCount(),
request.maxRedirectCount(),
true);
}
示例8: makeXmppUri
QString XmppUriQueries::makeXmppUri(const Jid &AContactJid, const QString &AAction, const QMultiMap<QString, QString> &AParams) const
{
if (AContactJid.isValid() && !AAction.isEmpty())
{
QUrl url;
url.setQueryDelimiters('=',';');
url.setScheme(XMPP_URI_SCHEME);
url.setPath(AContactJid.full());
QList< QPair<QString, QString> > query;
query.append(qMakePair<QString,QString>(AAction,QString::null));
for(QMultiMap<QString, QString>::const_iterator it=AParams.constBegin(); it!=AParams.end(); ++it)
query.append(qMakePair<QString,QString>(it.key(),it.value()));
url.setQueryItems(query);
return url.toString().replace(QString("?%1=;").arg(AAction),QString("?%1;").arg(AAction));
}
return QString::null;
}
示例9: concatUrlPath
QUrl Account::concatUrlPath(const QUrl &url, const QString &concatPath,
const QList< QPair<QString, QString> > &queryItems)
{
QString path = url.path();
if (! concatPath.isEmpty()) {
// avoid '//'
if (path.endsWith('/') && concatPath.startsWith('/')) {
path.chop(1);
} // avoid missing '/'
else if (!path.endsWith('/') && !concatPath.startsWith('/')) {
path += QLatin1Char('/');
}
path += concatPath; // put the complete path together
}
QUrl tmpUrl = url;
tmpUrl.setPath(path);
if( queryItems.size() > 0 ) {
tmpUrl.setQueryItems(queryItems);
}
return tmpUrl;
}
示例10: Add
void HistoryModel::Add (const HistoryItem& item)
{
int section = SectionNumber (item.DateTime_);
while (section >= RootItem_->ChildCount ())
{
QList<QVariant> data;
data << SectionName (RootItem_->ChildCount ())
<< QString ("")
<< QString ("");
TreeItem *folder = new TreeItem (data, RootItem_);
folder->ModifyData (0,
FolderIconProxy_->icon (),
Qt::DecorationRole);
RootItem_->AppendChild (folder);
}
QList<QVariant> data;
data << item.Title_
<< item.URL_
<< item.DateTime_;
TreeItem *folder = RootItem_->Child (section);
TreeItem *thisItem = new TreeItem (data, RootItem_->Child (section));
folder->PrependChild (thisItem);
QUrl url (item.URL_);
url.setFragment (QString ());
url.setPath (QString ());
url.setQueryItems (QList<QPair<QString, QString> > ());
QIcon icon = QWebSettings::iconForUrl (url);
if (icon.isNull ())
icon = UnknownURLProxy_->icon ();
thisItem->ModifyData (0,
icon, Qt::DecorationRole);
}
示例11: writeLayerXML
bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& document )
{
// use scale dependent visibility flag
layerElement.setAttribute( "hasScaleBasedVisibilityFlag", hasScaleBasedVisibility() ? 1 : 0 );
layerElement.setAttribute( "minimumScale", QString::number( minimumScale() ) );
layerElement.setAttribute( "maximumScale", QString::number( maximumScale() ) );
// ID
QDomElement layerId = document.createElement( "id" );
QDomText layerIdText = document.createTextNode( id() );
layerId.appendChild( layerIdText );
layerElement.appendChild( layerId );
// data source
QDomElement dataSource = document.createElement( "datasource" );
QString src = source();
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( this );
// TODO: what about postgres, mysql and others, they should not go through writePath()
if ( vlayer && vlayer->providerType() == "spatialite" )
{
QgsDataSourceURI uri( src );
QString database = QgsProject::instance()->writePath( uri.database() );
uri.setConnection( uri.host(), uri.port(), database, uri.username(), uri.password() );
src = uri.uri();
}
else if ( vlayer && vlayer->providerType() == "ogr" )
{
QStringList theURIParts = src.split( "|" );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0] );
src = theURIParts.join( "|" );
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
{
QUrl urlSource = QUrl::fromEncoded( src.toAscii() );
QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->writePath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
src = QString::fromAscii( urlDest.toEncoded() );
}
else
{
src = QgsProject::instance()->writePath( src );
}
QDomText dataSourceText = document.createTextNode( src );
dataSource.appendChild( dataSourceText );
layerElement.appendChild( dataSource );
// layer name
QDomElement layerName = document.createElement( "layername" );
QDomText layerNameText = document.createTextNode( originalName() );
layerName.appendChild( layerNameText );
// layer title
QDomElement layerTitle = document.createElement( "title" ) ;
QDomText layerTitleText = document.createTextNode( title() );
layerTitle.appendChild( layerTitleText );
// layer abstract
QDomElement layerAbstract = document.createElement( "abstract" );
QDomText layerAbstractText = document.createTextNode( abstract() );
layerAbstract.appendChild( layerAbstractText );
layerElement.appendChild( layerName );
layerElement.appendChild( layerTitle );
layerElement.appendChild( layerAbstract );
// layer keyword list
QStringList keywordStringList = keywordList().split( "," );
if ( keywordStringList.size() > 0 )
{
QDomElement layerKeywordList = document.createElement( "keywordList" );
for ( int i = 0; i < keywordStringList.size(); ++i )
{
QDomElement layerKeywordValue = document.createElement( "value" );
QDomText layerKeywordText = document.createTextNode( keywordStringList.at( i ).trimmed() );
layerKeywordValue.appendChild( layerKeywordText );
layerKeywordList.appendChild( layerKeywordValue );
}
layerElement.appendChild( layerKeywordList );
}
// layer metadataUrl
QString aDataUrl = dataUrl();
if ( !aDataUrl.isEmpty() )
{
QDomElement layerDataUrl = document.createElement( "dataUrl" ) ;
QDomText layerDataUrlText = document.createTextNode( aDataUrl );
layerDataUrl.appendChild( layerDataUrlText );
layerDataUrl.setAttribute( "format", dataUrlFormat() );
layerElement.appendChild( layerDataUrl );
}
// layer attribution
QString aAttribution = attribution();
if ( !aAttribution.isEmpty() )
//.........这里部分代码省略.........
示例12: readLayerXML
bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
{
QgsCoordinateReferenceSystem savedCRS;
CUSTOM_CRS_VALIDATION savedValidation;
bool layerError;
QDomNode mnl;
QDomElement mne;
// read provider
QString provider;
mnl = layerElement.namedItem( "provider" );
mne = mnl.toElement();
provider = mne.text();
// set data source
mnl = layerElement.namedItem( "datasource" );
mne = mnl.toElement();
mDataSource = mne.text();
// TODO: this should go to providers
if ( provider == "spatialite" )
{
QgsDataSourceURI uri( mDataSource );
uri.setDatabase( QgsProject::instance()->readPath( uri.database() ) );
mDataSource = uri.uri();
}
else if ( provider == "ogr" )
{
QStringList theURIParts = mDataSource.split( "|" );
theURIParts[0] = QgsProject::instance()->readPath( theURIParts[0] );
mDataSource = theURIParts.join( "|" );
}
else if ( provider == "delimitedtext" )
{
QUrl urlSource = QUrl::fromEncoded( mDataSource.toAscii() );
if ( !mDataSource.startsWith( "file:" ) )
{
QUrl file = QUrl::fromLocalFile( mDataSource.left( mDataSource.indexOf( "?" ) ) );
urlSource.setScheme( "file" );
urlSource.setPath( file.path() );
}
QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->readPath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
mDataSource = QString::fromAscii( urlDest.toEncoded() );
}
else if ( provider == "wms" )
{
// >>> BACKWARD COMPATIBILITY < 1.9
// For project file backward compatibility we must support old format:
// 1. mode: <url>
// example: http://example.org/wms?
// 2. mode: tiled=<width>;<height>;<resolution>;<resolution>...,ignoreUrl=GetMap;GetFeatureInfo,featureCount=<count>,username=<name>,password=<password>,url=<url>
// example: tiled=256;256;0.703;0.351,url=http://example.org/tilecache?
// example: featureCount=10,http://example.org/wms?
// example: ignoreUrl=GetMap;GetFeatureInfo,username=cimrman,password=jara,url=http://example.org/wms?
// This is modified version of old QgsWmsProvider::parseUri
// The new format has always params crs,format,layers,styles and that params
// should not appear in old format url -> use them to identify version
if ( !mDataSource.contains( "crs=" ) && !mDataSource.contains( "format=" ) )
{
QgsDebugMsg( "Old WMS URI format detected -> converting to new format" );
QgsDataSourceURI uri;
if ( !mDataSource.startsWith( "http:" ) )
{
QStringList parts = mDataSource.split( "," );
QStringListIterator iter( parts );
while ( iter.hasNext() )
{
QString item = iter.next();
if ( item.startsWith( "username=" ) )
{
uri.setParam( "username", item.mid( 9 ) );
}
else if ( item.startsWith( "password=" ) )
{
uri.setParam( "password", item.mid( 9 ) );
}
else if ( item.startsWith( "tiled=" ) )
{
// in < 1.9 tiled= may apper in to variants:
// tiled=width;height - non tiled mode, specifies max width and max height
// tiled=width;height;resolutions-1;resolution2;... - tile mode
QStringList params = item.mid( 6 ).split( ";" );
if ( params.size() == 2 ) // non tiled mode
{
uri.setParam( "maxWidth", params.takeFirst() );
uri.setParam( "maxHeight", params.takeFirst() );
}
else if ( params.size() > 2 ) // tiled mode
{
// resolutions are no more needed and size limit is not used for tiles
// we have to tell to the provider however that it is tiled
uri.setParam( "tileMatrixSet", "" );
}
}
//.........这里部分代码省略.........
示例13: writeXML
bool QgsMapLayer::writeXML( QDomNode & layer_node, QDomDocument & document )
{
// general layer metadata
QDomElement maplayer = document.createElement( "maplayer" );
// use scale dependent visibility flag
maplayer.setAttribute( "hasScaleBasedVisibilityFlag", hasScaleBasedVisibility() ? 1 : 0 );
maplayer.setAttribute( "minimumScale", minimumScale() );
maplayer.setAttribute( "maximumScale", maximumScale() );
// ID
QDomElement layerId = document.createElement( "id" );
QDomText layerIdText = document.createTextNode( id() );
layerId.appendChild( layerIdText );
maplayer.appendChild( layerId );
// data source
QDomElement dataSource = document.createElement( "datasource" );
QString src = source();
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( this );
if ( vlayer && vlayer->providerType() == "spatialite" )
{
QgsDataSourceURI uri( src );
QString database = QgsProject::instance()->writePath( uri.database() );
uri.setConnection( uri.host(), uri.port(), database, uri.username(), uri.password() );
src = uri.uri();
}
else if ( vlayer && vlayer->providerType() == "ogr" )
{
QStringList theURIParts = src.split( "|" );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0] );
src = theURIParts.join( "|" );
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
{
QUrl urlSource = QUrl::fromEncoded( src.toAscii() );
QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->writePath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
src = QString::fromAscii( urlDest.toEncoded() );
}
else
{
src = QgsProject::instance()->writePath( src );
}
QDomText dataSourceText = document.createTextNode( src );
dataSource.appendChild( dataSourceText );
maplayer.appendChild( dataSource );
// layer name
QDomElement layerName = document.createElement( "layername" );
QDomText layerNameText = document.createTextNode( name() );
layerName.appendChild( layerNameText );
// layer title
QDomElement layerTitle = document.createElement( "title" ) ;
QDomText layerTitleText = document.createTextNode( title() );
layerTitle.appendChild( layerTitleText );
// layer abstract
QDomElement layerAbstract = document.createElement( "abstract" );
QDomText layerAbstractText = document.createTextNode( abstract() );
layerAbstract.appendChild( layerAbstractText );
maplayer.appendChild( layerName );
maplayer.appendChild( layerTitle );
maplayer.appendChild( layerAbstract );
// timestamp if supported
if ( timestamp() > QDateTime() )
{
QDomElement stamp = document.createElement( "timestamp" );
QDomText stampText = document.createTextNode( timestamp().toString( Qt::ISODate ) );
stamp.appendChild( stampText );
maplayer.appendChild( stamp );
}
maplayer.appendChild( layerName );
// zorder
// This is no longer stored in the project file. It is superfluous since the layers
// are written and read in the proper order.
// spatial reference system id
QDomElement mySrsElement = document.createElement( "srs" );
mCRS->writeXML( mySrsElement, document );
maplayer.appendChild( mySrsElement );
// <transparencyLevelInt>
QDomElement transparencyLevelIntElement = document.createElement( "transparencyLevelInt" );
QDomText transparencyLevelIntText = document.createTextNode( QString::number( getTransparency() ) );
transparencyLevelIntElement.appendChild( transparencyLevelIntText );
maplayer.appendChild( transparencyLevelIntElement );
// now append layer node to map layer node
//.........这里部分代码省略.........
示例14: QObject
ConcreteSite::ConcreteSite (const Media::LyricsQuery& query,
const ConcreteSiteDesc& desc, ICoreProxy_ptr proxy, QObject *parent)
: QObject (parent)
, Query_ (query)
, Desc_ (desc)
{
auto replace = [this] (QString str) -> QString
{
for (const auto& c : Desc_.Replacements_.keys ())
str.replace (c, Desc_.Replacements_ [c]);
return str;
};
const auto& artist = replace (query.Artist_.toLower ());
const auto& album = replace (query.Album_.toLower ());
const auto& title = replace (query.Title_.toLower ());
auto urlStr = Desc_.URLTemplate_;
urlStr.replace ("{artist}", artist);
urlStr.replace ("{album}", album);
urlStr.replace ("{title}", title);
if (!artist.isEmpty ())
urlStr.replace ("{a}", artist.at (0).toLower ());
auto cap = [] (QString str) -> QString
{
if (!str.isEmpty ())
str [0] = str [0].toUpper ();
return str;
};
urlStr.replace ("{Artist}", cap (artist));
urlStr.replace ("{Album}", cap (album));
urlStr.replace ("{Title}", cap (title));
#ifdef QT_DEBUG
qDebug () << Q_FUNC_INFO
<< "requesting"
<< urlStr
<< "from"
<< Desc_.Name_
<< "for"
<< artist
<< album
<< title;
#endif
auto nam = proxy->GetNetworkAccessManager ();
QUrl url { urlStr };
QNetworkRequest req { url };
url.setPath ({});
#if QT_VERSION < 0x050000
url.setQueryItems ({});
#else
url.setQuery ({});
#endif
req.setRawHeader ("Referer", url.toString ().toUtf8 ());
auto reply = nam->get (req);
connect (reply,
SIGNAL (finished ()),
this,
SLOT (handleReplyFinished ()));
connect (reply,
SIGNAL (error (QNetworkReply::NetworkError)),
this,
SLOT (handleReplyError ()));
}
示例15: writeLayerXML
bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& document, const QString& relativeBasePath )
{
// use scale dependent visibility flag
layerElement.setAttribute( "hasScaleBasedVisibilityFlag", hasScaleBasedVisibility() ? 1 : 0 );
layerElement.setAttribute( "minimumScale", QString::number( minimumScale() ) );
layerElement.setAttribute( "maximumScale", QString::number( maximumScale() ) );
// ID
QDomElement layerId = document.createElement( "id" );
QDomText layerIdText = document.createTextNode( id() );
layerId.appendChild( layerIdText );
layerElement.appendChild( layerId );
// data source
QDomElement dataSource = document.createElement( "datasource" );
QString src = source();
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( this );
// TODO: what about postgres, mysql and others, they should not go through writePath()
if ( vlayer && vlayer->providerType() == "spatialite" )
{
QgsDataSourceURI uri( src );
QString database = QgsProject::instance()->writePath( uri.database(), relativeBasePath );
uri.setConnection( uri.host(), uri.port(), database, uri.username(), uri.password() );
src = uri.uri();
}
else if ( vlayer && vlayer->providerType() == "ogr" )
{
QStringList theURIParts = src.split( "|" );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0], relativeBasePath );
src = theURIParts.join( "|" );
}
else if ( vlayer && vlayer->providerType() == "gpx" )
{
QStringList theURIParts = src.split( "?" );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0], relativeBasePath );
src = theURIParts.join( "?" );
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
{
QUrl urlSource = QUrl::fromEncoded( src.toAscii() );
QUrl urlDest = QUrl::fromLocalFile( QgsProject::instance()->writePath( urlSource.toLocalFile(), relativeBasePath ) );
urlDest.setQueryItems( urlSource.queryItems() );
src = QString::fromAscii( urlDest.toEncoded() );
}
else
{
bool handled = false;
if ( !vlayer )
{
QgsRasterLayer *rlayer = qobject_cast<QgsRasterLayer *>( this );
// Update path for subdataset
if ( rlayer && rlayer->providerType() == "gdal" )
{
if ( src.startsWith( "NETCDF:" ) )
{
// NETCDF:filename:variable
// filename can be quoted with " as it can contain colons
QRegExp r( "NETCDF:(.+):([^:]+)" );
if ( r.exactMatch( src ) )
{
QString filename = r.cap( 1 );
if ( filename.startsWith( '"' ) && filename.endsWith( '"' ) )
filename = filename.mid( 1, filename.length() - 2 );
src = "NETCDF:\"" + QgsProject::instance()->writePath( filename, relativeBasePath ) + "\":" + r.cap( 2 );
handled = true;
}
}
else if ( src.startsWith( "HDF4_SDS:" ) )
{
// HDF4_SDS:subdataset_type:file_name:subdataset_index
// filename can be quoted with " as it can contain colons
QRegExp r( "HDF4_SDS:([^:]+):(.+):([^:]+)" );
if ( r.exactMatch( src ) )
{
QString filename = r.cap( 2 );
if ( filename.startsWith( '"' ) && filename.endsWith( '"' ) )
filename = filename.mid( 1, filename.length() - 2 );
src = "HDF4_SDS:" + r.cap( 1 ) + ":\"" + QgsProject::instance()->writePath( filename, relativeBasePath ) + "\":" + r.cap( 3 );
handled = true;
}
}
else if ( src.startsWith( "HDF5:" ) )
{
// HDF5:file_name:subdataset
// filename can be quoted with " as it can contain colons
QRegExp r( "HDF5:(.+):([^:]+)" );
if ( r.exactMatch( src ) )
{
QString filename = r.cap( 1 );
if ( filename.startsWith( '"' ) && filename.endsWith( '"' ) )
filename = filename.mid( 1, filename.length() - 2 );
src = "HDF5:\"" + QgsProject::instance()->writePath( filename, relativeBasePath ) + "\":" + r.cap( 2 );
handled = true;
}
}
else if ( src.contains( QRegExp( "^(NITF_IM|RADARSAT_2_CALIB):" ) ) )
//.........这里部分代码省略.........