Compatibility Members for QUrl

The following members of class QUrlare part of the Qt compatibility layer. We advise against using them in new code.

Public Functions

void addPath(const QString & p)
bool cdUp()
QString dirPath() const
QString fileName() const
bool hasHost() const
bool hasPassword() const
bool hasPath() const
bool hasPort() const
bool hasRef() const
bool hasUser() const
QString protocol() const
QString query() const
QString ref() const
void setFileName(const QString & txt)
void setProtocol(const QString & s)
void setQuery(const QString & txt)
void setRef(const QString & txt)
void setUser(const QString & s)
QString user() const
operator QString() const

Static Public Members

void decode(QString & url)
void encode(QString & url)
bool isRelativeUrl(const QString & url)

Protected Functions

void reset()

Member Function Documentation

void QUrl::addPath(const QString & p)

Use setPath() instead.

bool QUrl::cdUp()

Use resolved("..") instead.

For example, if you have code like

QUrl url("http://example.com/Developer/");
url.cdUp();

you can rewrite it as

QUrl url("http://example.com/Developer/");
url = url.resolved("..");

[static] void QUrl::decode(QString & url)

Use fromPercentEncoding() instead.

QString QUrl::dirPath() const

Use QFileInfo(path()).absolutePath() or QFileInfo(path()) instead.

[static] void QUrl::encode(QString & url)

Use toPercentEncoding() instead.

QString QUrl::fileName() const

Use QFileInfo(path()).fileName() instead.

See also setFileName().

bool QUrl::hasHost() const

Use !host().isEmpty() instead.

bool QUrl::hasPassword() const

Use !password().isEmpty() instead.

bool QUrl::hasPath() const

Use !path().isEmpty() instead.

bool QUrl::hasPort() const

Use port() != -1 instead.

bool QUrl::hasRef() const

Use !fragment().isEmpty() instead.

bool QUrl::hasUser() const

Use !userName().isEmpty() instead.

[static] bool QUrl::isRelativeUrl(const QString & url)

Use isRelative() instead.

QString QUrl::protocol() const

Use scheme() instead.

See also setProtocol().

QString QUrl::query() const

Use encodedQuery() instead.

See also setQuery().

QString QUrl::ref() const

Use fragment() instead.

See also setRef().

[protected] void QUrl::reset()

Use clear() instead.

void QUrl::setFileName(const QString & txt)

Use setPath() instead.

See also fileName().

void QUrl::setProtocol(const QString & s)

Use setScheme() instead.

See also protocol().

void QUrl::setQuery(const QString & txt)

Use setEncodedQuery() instead.

See also query().

void QUrl::setRef(const QString & txt)

Use setFragment() instead.

See also ref().

void QUrl::setUser(const QString & s)

Use setUserName() instead.

See also user().

QString QUrl::user() const

Use userName() instead.

See also setUser().

QUrl::operator QString() const

Use toString() instead.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.