Compatibility Members for QUrl

以下成员源于类 QUrl are part of the Qt compatibility layer. We advise against using them in new code.

公共函数

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

静态公共成员

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

保护函数

void reset ()

成员函数文档编制

void QUrl:: addPath (const QString & p )

使用 setPath () 代替。

bool QUrl:: cdUp ()

Use resolved("..") instead.

例如,若有代码像

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

可以把它重写成

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

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

使用 fromPercentEncoding () 代替。

QString QUrl:: dirPath () const

使用 QFileInfo ( path ()).absolutePath() or QFileInfo ( path ()) instead.

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

使用 toPercentEncoding () 代替。

QString QUrl:: fileName () const

使用 QFileInfo ( path ()).fileName() instead.

另请参阅 setFileName ().

bool QUrl:: hasHost () const

Use ! host (). isEmpty () 代替。

bool QUrl:: hasPassword () const

Use ! password (). isEmpty () 代替。

bool QUrl:: hasPath () const

Use ! path (). isEmpty () 代替。

bool QUrl:: hasPort () const

使用 port () != -1 instead.

bool QUrl:: hasRef () const

Use ! fragment (). isEmpty () 代替。

bool QUrl:: hasUser () const

Use ! userName (). isEmpty () 代替。

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

使用 isRelative () 代替。

QString QUrl:: protocol () const

使用 scheme () 代替。

另请参阅 setProtocol ().

QString QUrl:: query () const

使用 encodedQuery () 代替。

另请参阅 setQuery ().

QString QUrl:: ref () const

使用 fragment () 代替。

另请参阅 setRef ().

[protected] void QUrl:: reset ()

使用 clear () 代替。

void QUrl:: setFileName (const QString & txt )

使用 setPath () 代替。

另请参阅 fileName ().

void QUrl:: setProtocol (const QString & s )

使用 setScheme () 代替。

另请参阅 protocol ().

void QUrl:: setQuery (const QString & txt )

使用 setEncodedQuery () 代替。

另请参阅 query ().

void QUrl:: setRef (const QString & txt )

使用 setFragment () 代替。

另请参阅 ref ().

void QUrl:: setUser (const QString & s )

使用 setUserName () 代替。

另请参阅 user ().

QString QUrl:: user () const

使用 userName () 代替。

另请参阅 setUser ().

QUrl:: operator QString () const

使用 toString () 代替。