#include <QUrl>
#include<QDebug>
#include<QFileInfo>

int main()
{

QUrl url("ftp.trolltech.com/mirrors");

if(!url.isValid())
qDebug() << "Url is invalid";

// url.setHost(url.toString());
// url.setHost(url.path());
qDebug() << "url.host() = " << url.host(); // not getting host name ......???????

qDebug() << "Url.path() = "<<url.path();
qDebug() << "url.scheme() = " <<url.scheme();
qDebug() << "QFileInfo(url.path()).fileName() = "<<QFileInfo(url.path()).fileName();
qDebug() << "url.port() = " << url.port(21);

// The other case tried by keeping scheme is as shown below .. still not getting hostname ..?????

QUrl url1("ftp:172.18.217.90");
qDebug() << "url1.host() = " << url1.host();

return 0;
}