QAbstractUriResolverclass is a callback interface for resolving Uniform Resource Identifiers. A Uniform Resource Identifier (URI) is a string that uniquely identifies a resource. URIs are versatile global identifiers. It is often useful to transform a URI that identifies something logical into a URI that locates something physical (a URL), or to simply map a URI to a different URI.resolve()provides this functionality. 更多 …
For example, one could write a
QAbstractUriResolversubclass that rewrites library ISBN number URIs as book title URLs, e.g., urn:isbn:0-345-33973-8 would be rewritten as file:///books/returnOfTheKing.doc . Or aQAbstractUriResolversubclass could be written for a web browser to let the web browser protect the user’s private files by mapping incoming requests for them to null URIs.
QAbstractUriResolver
(
[
parent=None
]
)
¶
- param parent
QObject
构造
QAbstractUriResolver
with the specified
parent
.
PySide2.QtXmlPatterns.QAbstractUriResolver.
resolve
(
relative
,
baseURI
)
¶
relative
–
QUrl
baseURI
–
QUrl
QUrl
返回
relative
URI resolved using the
baseURI
.
The caller guarantees that both
relative
and
baseURI
are valid, and that
baseURI
is absolute.
relative
can be relative, absolute, or empty.
返回的
QUrl
can be a default constructed
QUrl
. If it is not a default constructed
QUrl
, it will be absolute and valid. If a default constructed
QUrl
is returned, it means the
relative
URI was not accepted to be resolved.
If the reimplemented function decides it has nothing to do about resolving the
relative
URI, it should simply return the
relative
URI resolved against the
baseURI
, i.e.:
return baseURI.resolved(relative);
另请参阅
isRelative()
isValid()