QUrl url("http://username:[email protected]/path"); QString newPwd = "newpassword"; url.setPassword(newPwd);
QUrl url("http://example.com/path"); QString newPwd = "password"; url.setPassword(newPwd);In this example, we create a new QUrl object with a URL that does not contain a username component. The setPassword() method is then used to set the password component to a new string value. Package Library: Qt Framework (QtCore module)