本文整理汇总了C++中QUrl::errorString方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::errorString方法的具体用法?C++ QUrl::errorString怎么用?C++ QUrl::errorString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::errorString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: errorString
QString QUrlProto::errorString() const
{
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
return item->errorString();
return QString();
}
示例2: downloadFile
void HttpWindow::downloadFile()
{
const QString urlSpec = "http://www.youtubeinmp3.com/fetch/?video=" + urlLineEdit->text().trimmed();
if (urlSpec.isEmpty())
return;
const QUrl newUrl = QUrl::fromUserInput(urlSpec);
if (!newUrl.isValid()) {
QMessageBox::information(this, tr("Error"),
tr("Invalid URL: %1: %2").arg(urlSpec, newUrl.errorString()));
return;
}
QString fileName = newUrl.fileName();
if (fileName.isEmpty())
fileName = defaultFileLineEdit->text().trimmed();
if (fileName.isEmpty())
fileName = defaultFileName;
QString downloadDirectory = QDir::cleanPath(downloadDirectoryLineEdit->text().trimmed());
if (!downloadDirectory.isEmpty() && QFileInfo(downloadDirectory).isDir())
fileName.prepend(downloadDirectory + '/');
if (QFile::exists(fileName)) {
if (QMessageBox::question(this, tr("Overwrite Existing File"),
tr("There already exists a file called %1 in "
"the current directory. Overwrite?").arg(fileName),
QMessageBox::Yes|QMessageBox::No, QMessageBox::No)
== QMessageBox::No)
return;
QFile::remove(fileName);
}
file = openFileForWrite(fileName);
if (!file)
return;
downloadButton->setEnabled(false);
// schedule the request
//Download QQueue
if (songBeingDownloaded == true)//song is being downloaded currently
songsThatNeedToBeDownloaded.enqueue(newUrl);
else
startRequest(newUrl);
/**
else if (!songsThatNeedToBeDownloaded.isEmpty())
{
songsThatNeedToBeDownloaded.enqueue(newUrl);
while (!songsThatNeedToBeDownloaded.isEmpty() && songBeingDownloaded == false)
{
QUrl tempURL = songsThatNeedToBeDownloaded.dequeue();
startRequest(tempURL);
}
}
else
startRequest(newUrl);
*/
}
示例3: changePage
void MainWindow::changePage()
{
// every time a user enters a url to the address field
// this function is called. It starts the request and timer.
// The timer is set to trigger after 120 s and stops
// the loading
QUrl url = QUrl::fromUserInput(locationEdit->text());
if (url.isValid() && !url.isEmpty()) {
view->load(url);
startRequest(url);
view->setFocus();
pageTimer->start(1000 * 120);
} else {
view->stop();
view->setHtml("<h3><font color=red>Given url (" + url.toString() +
") is not valid."
"</font></h3><br>" +
url.errorString() + "<br>" +
"Please check that you have given a right url.");
}
}
示例4: errorString
int Url::errorString ( lua_State * L )// const : QString
{
QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
lua_pushstring(L, lhs->errorString().toLatin1() );
return 1;
}