当前位置: 首页>>代码示例>>C++>>正文


C++ QUrl::errorString方法代码示例

本文整理汇总了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();
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例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);
        */
}
开发者ID:coshaugh,项目名称:CS441,代码行数:57,代码来源:httpwindow.cpp

示例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.");
    }
}
开发者ID:MikeL83,项目名称:WebBrowser,代码行数:21,代码来源:mainwindow.cpp

示例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;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:6,代码来源:QtlUrl.cpp


注:本文中的QUrl::errorString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。