52 QUrl url(
"http://www.example.com/List of holidays.xml");
87 QUrl relativeUrl(
"../Product/Library/");
100 QUrl url(
"http://qt-project.org/support/file.html");
107 qDebug() <<
QUrl(
"qml/main.qml").isRelative();
108 qDebug() <<
QUrl(
"file:main.qml").isRelative();
109 qDebug() <<
QUrl(
"file:qml/main.qml").isRelative();
119 url =
QUrl(
"/home/user/file.txt");
125 QUrl original(
"http://example.com/?q=a%2B%3Db%26c");
129 qDebug() << original.toString();
130 qDebug() << copy.toString();
140 qDebug() <<
QUrl(
"/home/user/file.txt").path();
141 qDebug() <<
QUrl(
"http://www.example.com/test/123").path();
186 qDebug() <<
QUrl(
"file:file.txt").toLocalFile();
187 qDebug() <<
QUrl(
"file:/home/user/file.txt").toLocalFile();
virtual void connectToHost(const QString &hostName, quint16 port, OpenMode mode=ReadWrite, NetworkLayerProtocol protocol=AnyIPProtocol)
The QByteArray class provides an array of bytes.
const char * constData() const noexcept
static bool isAbsolutePath(const QString &path)
The QTcpSocket class provides a TCP socket.
The QUrl class provides a convenient interface for working with URLs.
static QUrl fromLocalFile(const QString &localfile)
QUrl resolved(const QUrl &relative) const
QString host(ComponentFormattingOptions=FullyDecoded) const
static QByteArray toPercentEncoding(const QString &, const QByteArray &exclude=QByteArray(), const QByteArray &include=QByteArray())
static QUrl fromEncoded(const QByteArray &url, ParsingMode mode=TolerantMode)
void setScheme(const QString &scheme)
QUrl(const QString &url, ParsingMode parsingMode)
int port(int defaultPort=-1) const
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
QString path(ComponentFormattingOptions options=FullyDecoded) const
QUrl url("http://www.example.com/List of holidays.xml")
[0]
bool checkUrl(const QUrl &url)
[1]
qDebug(baseUrl.resolved(relativeUrl).toString())