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


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

本文整理汇总了C++中QUrl::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::clear方法的具体用法?C++ QUrl::clear怎么用?C++ QUrl::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QUrl的用法示例。


在下文中一共展示了QUrl::clear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseListHtml

void KryptoniteJobCoverDiscogs::parseListHtml( const QByteArray &data )
{
   emit message( tr( "Parsing discogs search reply" ), data );
   QRegExp imgRe( ".*<img[^>]*class=[^>]*search_result_image[^>]*src=\"([^\"]*)\".*" );
   QRegExp linkRe( ".*<a[^>]*class=[^>]*search_result_title[^>]*href=\"([^\"]*)\".*" );
   QString s( QString::fromUtf8(data.constData()) );
   QStringList l( s.split("\n", QString::SkipEmptyParts) );
   QUrl imgUrl;
   QUrl linkUrl;
   foreach( s, l )
   {
      if( s.contains( imgRe ) )
      {
         imgUrl.setUrl( QString(s).replace( imgRe, "\\1" ) );
      }
      if( s.contains( linkRe ) )
      {
         linkUrl.setUrl( QString(s).replace( linkRe, "http://www.discogs.com\\1" ) );
      }
      if( !imgUrl.isEmpty() && !linkUrl.isEmpty() )
      {
         emit requestDownload( this, SIGNAL(imageFound(QByteArray,QVariant)), imgUrl, QVariant( linkUrl ) );
         imgUrl.clear();
         linkUrl.clear();
      }
   }
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: clear

	void clear(){
		resourceUrl->clear();
		resourceEncodeQueryItems->clear();
		acceptType->clear();
		refererUrl->clear();
		refererEncodeQueryItems->clear();
		vaild = true;
	}
开发者ID:CUITCHE,项目名称:ZhiFan,代码行数:8,代码来源:HttpRequestParser.cpp

示例3: finished

bool DetermineAuthTypeJob::finished()
{
    QUrl redirection = reply()->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
    qDebug() << Q_FUNC_INFO << redirection.toString();
    if (_redirects >= maxRedirects()) {
        redirection.clear();
    }
    if ((reply()->error() == QNetworkReply::AuthenticationRequiredError) || redirection.isEmpty()) {
        emit authType(WizardCommon::HttpCreds);
    } else if (redirection.toString().endsWith(account()->davPath())) {
        // do a new run
        _redirects++;
        resetTimeout();
        setReply(getRequest(redirection));
        setupConnections(reply());
        return false; // don't discard
    } else {
        QRegExp shibbolethyWords("SAML|wayf");

        shibbolethyWords.setCaseSensitivity(Qt::CaseInsensitive);
        if (redirection.toString().contains(shibbolethyWords)) {
            emit authType(WizardCommon::Shibboleth);
        } else {
            // TODO: Send an error.
            // eh?
            emit authType(WizardCommon::HttpCreds);
        }
    }
    return true;
}
开发者ID:AppSync1024,项目名称:client,代码行数:30,代码来源:owncloudsetupwizard.cpp

示例4: run

void BookmarksRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action)
{
    Q_UNUSED(context);
    const QString term = action.data().toString();
    QUrl url = QUrl(term);

    //support urls like "kde.org" by transforming them to http://kde.org
    if (url.scheme().isEmpty()) {
        const int idx = term.indexOf('/');

        url.clear();
        url.setHost(term.left(idx));
        if (idx != -1) {
            //allow queries
            const int queryStart = term.indexOf('?', idx);
            int pathLength = -1;
            if ((queryStart > -1) && (idx < queryStart)) {
                pathLength = queryStart - idx;
                url.setQuery(term.mid(queryStart));
            }

            url.setPath(term.mid(idx, pathLength));
        }
        url.setScheme(QStringLiteral("http"));
    }

    KToolInvocation::invokeBrowser(url.url());
}
开发者ID:cmacq2,项目名称:plasma-workspace,代码行数:28,代码来源:bookmarksrunner.cpp

示例5: parseFiles


//.........这里部分代码省略.........

                    // Hinzufügen des endungsabhängigen Icons
                    // PDF
                    if (name.contains(QRegExp(".pdf$", Qt::CaseInsensitive)))
                        newFile->setData(QIcon(":/Icons/Icons/filetype_pdf.png"), Qt::DecorationRole);

                    // ZIP
                    else if (name.contains(QRegExp(".zip$", Qt::CaseInsensitive)))
                        newFile->setData(QIcon(":/Icons/Icons/filetype_zip.png"), Qt::DecorationRole);

                    // RAR
                    else if (name.contains(QRegExp(".rar$", Qt::CaseInsensitive)))
                        newFile->setData(QIcon(":/Icons/Icons/filetype_rar.png"), Qt::DecorationRole);

                    // Sonstige
                    else
                        newFile->setData(QIcon(":/Icons/Icons/file.png"), Qt::DecorationRole);


                    QString path;
                    path.append(Utils::getStrukturelementPfad(aktuellerOrdner, downloadDirectoryPath) %"/");
                    path.append(name);
                    path.remove(0,8);

                    if(QFile::exists(path))
                    {
                        newFile->setData(SYNCHRONISED, synchronisedRole);
                    }
                    else
                    {
                        newFile->setData(NOT_SYNCHRONISED, synchronisedRole);
                    }

                    QList<QStandardItem*> row;
                    row.append(newFile);
                    row.append(new QStandardItem(QString::number(size/1024.0/1024.0, 'f', 2) % " MB"));
                    row.append(new QStandardItem(QDateTime::fromString(time, Qt::ISODate).toString("yyyy-MM-dd hh:mm")));

                    // Hinzufügen zum aktuellen Ordner
                    aktuellerOrdner->appendRow(row);
                }
                // 2. Fall: Ordner/Veranstaltung
                // Ausschließen der Ordnernamen "documents" und "structured"
                else if (name != "documents" && name != "structured" && !url.toString().contains("exerciseCourse"))
                {
                    // Erstellen eines neuen Ordners
                    Structureelement* newDirectory = new Structureelement(name, url, directoryItem);

                    // Setzen des Zeichens
                    newDirectory->setData(QIcon(":/Icons/Icons/25_folder.png"), Qt::DecorationRole);

                    // Hinzufügen zum aktuellen Ordner
                    aktuellerOrdner->appendRow(newDirectory);

                    // NeuerOrdner wird zum aktuellen Ordner
                    aktuellerOrdner = newDirectory;
                }
            }

            // Löschen aller eingelesener Daten
            url.clear();
            name.clear();
            size = 0;
            time.clear();
        }

        // Einlesen der Elementeigenschaften
        else if (Reader.isCharacters() && !Reader.isWhitespace())
        {
            // URL
            if(currentXmlTag == "href" && url.isEmpty())
                url.setUrl(QString::fromUtf8(Reader.text().toString().toUtf8()));

            // Name
            else if (currentXmlTag == "displayname")
                name = QString::fromUtf8(Reader.text().toString().toUtf8());

            // Größe
            else if (currentXmlTag == "getcontentlength")
                size = Reader.text().toString().toInt();

            // Modifizierungsdatum
            else if (currentXmlTag == "getlastmodified")
                time = QString::fromUtf8(Reader.text().toString().toLatin1());
        }
    }

    // Leere Ordner wieder rausschmeißen.
    Structureelement* rootCourse = replies->value(reply);
    for (int i = 0; i < rootCourse->rowCount(); i++)
    {
        Structureelement *item = (Structureelement *)rootCourse->child(i);
        if (item->type() == directoryItem && item->rowCount() == 0)
        {
            rootCourse->removeRow(i);
        }
    }
    // Sortieren aller Dateien
    replies->value(reply)->sortChildren(0, Qt::AscendingOrder);
}
开发者ID:kevle,项目名称:Sync-my-L2P,代码行数:101,代码来源:parser.cpp

示例6: postLaunch

void BrowserWindow::postLaunch()
{
    loadSettings();

    bool addTab = true;
    QUrl startUrl;

    switch (mApp->afterLaunch()) {
    case MainApplication::OpenBlankPage:
        startUrl = QUrl();
        break;

    case MainApplication::OpenSpeedDial:
        startUrl = QUrl("qupzilla:speeddial");
        break;

    case MainApplication::OpenHomePage:
    case MainApplication::RestoreSession:
        startUrl = m_homepage;
        break;

    default:
        break;
    }

    switch (m_windowType) {
    case Qz::BW_FirstAppWindow:
        if (mApp->isStartingAfterCrash()) {
            addTab = false;
            startUrl.clear();
            m_tabWidget->addView(QUrl("qupzilla:restore"), Qz::NT_CleanSelectedTabAtTheEnd);
        }
        else if (mApp->afterLaunch() == MainApplication::RestoreSession && mApp->restoreManager()) {
            addTab = !mApp->restoreSession(this, mApp->restoreManager()->restoreData());
        }
        else {
            // Restore pinned tabs also when not restoring session
            m_tabWidget->restorePinnedTabs();
        }
        break;

    case Qz::BW_MacFirstWindow:
        m_tabWidget->restorePinnedTabs();
        // fallthrough

    case Qz::BW_NewWindow:
        addTab = true;
        break;

    case Qz::BW_OtherRestoredWindow:
        addTab = false;
        break;
    }

    show();

    if (!m_startUrl.isEmpty()) {
        startUrl = m_startUrl;
        addTab = true;
    }

    if (m_startTab) {
        addTab = false;
        m_tabWidget->addView(m_startTab);
    }

    if (m_startPage) {
        addTab = false;
        m_tabWidget->addView(QUrl());
        weView()->setPage(m_startPage);
    }

    if (addTab) {
        m_tabWidget->addView(startUrl, Qz::NT_CleanSelectedTabAtTheEnd);

        if (startUrl.isEmpty() || startUrl.toString() == QLatin1String("qupzilla:speeddial")) {
            locationBar()->setFocus();
        }
    }

    // Something went really wrong .. add one tab
    if (m_tabWidget->tabBar()->normalTabsCount() <= 0) {
        m_tabWidget->addView(m_homepage, Qz::NT_SelectedTabAtTheEnd);
    }

    mApp->plugins()->emitMainWindowCreated(this);
    emit startingCompleted();

    raise();
    activateWindow();

    QTimer::singleShot(0, this, [this]() {
        // Scroll to current tab
        tabWidget()->tabBar()->ensureVisible();

        // Update focus
        if (LocationBar::convertUrlToText(weView()->page()->requestedUrl()).isEmpty())
            locationBar()->setFocus();
        else
            weView()->setFocus();
//.........这里部分代码省略.........
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:101,代码来源:browserwindow.cpp

示例7: testRunner

void LocalQmlProfilerRunnerTest::testRunner()
{
    QmlProfilerTool tool;
    QPointer<ProjectExplorer::RunControl> runControl;
    QPointer<LocalQmlProfilerSupport> profiler;
    ProjectExplorer::StandardRunnable debuggee;
    QUrl serverUrl;

    bool running = false;
    bool started = false;
    int startCount = 0;
    int runCount = 0;
    int stopCount = 0;

    debuggee.executable = "\\-/|\\-/";
    debuggee.environment = Utils::Environment::systemEnvironment();

    // should not be used anywhere but cannot be empty
    serverUrl.setScheme(Utils::urlSocketScheme());
    serverUrl.setPath("invalid");

    runControl = new ProjectExplorer::RunControl(nullptr,
                                                 ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
    runControl->setRunnable(debuggee);
    profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);

    auto connectRunner = [&]() {
        connect(runControl, &ProjectExplorer::RunControl::aboutToStart, this, [&]() {
            QVERIFY(!started);
            QVERIFY(!running);
            ++startCount;
            started = true;
        });
        connect(runControl, &ProjectExplorer::RunControl::started, this, [&]() {
            QVERIFY(started);
            QVERIFY(!running);
            ++runCount;
            running = true;
        });
        connect(runControl, &ProjectExplorer::RunControl::stopped, this, [&]() {
            QVERIFY(started);
            ++stopCount;
            running = false;
            started = false;
        });
        connect(runControl, &ProjectExplorer::RunControl::finished, this, [&]() {
            running = false;
            started = false;
        });
    };

    connectRunner();

    runControl->initiateStart();

    QTRY_COMPARE_WITH_TIMEOUT(startCount, 1, 30000);
    QTRY_VERIFY_WITH_TIMEOUT(!started, 30000);
    QCOMPARE(stopCount, 1);
    QCOMPARE(runCount, 0);

    runControl->initiateFinish();
    QTRY_VERIFY(runControl.isNull());
    QVERIFY(profiler.isNull());

    serverUrl = Utils::urlFromLocalSocket();
    debuggee.executable = qApp->applicationFilePath();

    // comma is used to specify a test function. In this case, an invalid one.
    debuggee.commandLineArguments = QString("-test QmlProfiler,");
    runControl = new ProjectExplorer::RunControl(nullptr,
                                                 ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
    runControl->setRunnable(debuggee);
    profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
    connectRunner();
    runControl->initiateStart();

    QTRY_VERIFY_WITH_TIMEOUT(running, 30000);
    QTRY_VERIFY_WITH_TIMEOUT(!running, 30000);
    QCOMPARE(startCount, 2);
    QCOMPARE(stopCount, 2);
    QCOMPARE(runCount, 1);

    runControl->initiateFinish();
    QTRY_VERIFY(runControl.isNull());
    QVERIFY(profiler.isNull());

    debuggee.commandLineArguments.clear();
    serverUrl.clear();
    serverUrl = Utils::urlFromLocalHostAndFreePort();
    runControl = new ProjectExplorer::RunControl(nullptr,
                                                 ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
    runControl->setRunnable(debuggee);
    profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
    connectRunner();
    runControl->initiateStart();

    QTRY_VERIFY_WITH_TIMEOUT(running, 30000);
    runControl->initiateStop();
    QTRY_VERIFY_WITH_TIMEOUT(!running, 30000);
    QCOMPARE(startCount, 3);
//.........这里部分代码省略.........
开发者ID:choenig,项目名称:qt-creator,代码行数:101,代码来源:localqmlprofilerrunner_test.cpp

示例8: clear

void QUrlProto::clear()
{
  QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
  if (item)
    item->clear();
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例9: clear

int Url::clear ( lua_State * L )
{
	QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
	lhs->clear();
	return 0;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:6,代码来源:QtlUrl.cpp

示例10: slotReplyFinished

//
// There have been problems with the finish-signal coming from the networkmanager.
// To avoid that, the reply-signals were connected and the data is taken from the
// sender() method.
//
void ownCloudInfo::slotReplyFinished()
{
    QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
    QSslConfiguration sslConfig = reply->sslConfiguration();
    if (!sslConfig.isNull()) {
        QMutexLocker lock(&_certChainMutex);
        _certificateChain = sslConfig.peerCertificateChain();
    }

    if( ! reply ) {
        qDebug() << "ownCloudInfo: Reply empty!";
        return;
    }

    // Detect redirect url
    QUrl possibleRedirUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
    /* We'll deduct if the redirection is valid in the redirectUrl function */


    if (!possibleRedirUrl.isEmpty() && _redirectCount++  > 10) {
        // Are we in a redirect loop
        qDebug() << "Redirect loop while redirecting to" << possibleRedirUrl;
        possibleRedirUrl.clear();
    }

    if(!possibleRedirUrl.isEmpty()) {
        QString configHandle;

        qDebug() << "Redirected to " << possibleRedirUrl;

        // We'll do another request to the redirection url.
        // an empty config handle is ok for the default config.
        if( _configHandleMap.contains(reply) ) {
            configHandle = _configHandleMap[reply];
            qDebug() << "Redirect: Have a custom config handle: " << configHandle;
        }

        QString path = _directories[reply];
        if (path.isEmpty()) {
            path = QLatin1String("status.php");
        } else {
            path.prepend( QLatin1String(WEBDAV_PATH) );
        }
        qDebug() << "This path was redirected: " << path;

        QString newUrl = possibleRedirUrl.toString();
        if( !path.isEmpty() && newUrl.endsWith( path )) {
            // cut off the trailing path
            newUrl.chop( path.length() );
            _urlRedirectedTo = newUrl;
            qDebug() << "Updated url to" << newUrl;
            getRequest( possibleRedirUrl );
        } else {
            qDebug() << "WRN: Path is not part of the redirect URL. NO redirect.";
        }
        reply->deleteLater();
        _directories.remove(reply);
        _configHandleMap.remove(reply);
        return;
    }

    // TODO: check if this is always the correct encoding
    const QString version = QString::fromUtf8( reply->readAll() );
    const QString url = reply->url().toString();
    QString plainUrl(url);
    plainUrl.remove( QLatin1String("/status.php"));

    QString info( version );

    if( url.endsWith( QLatin1String("status.php")) ) {
        // it was a call to status.php
        if( reply->error() == QNetworkReply::NoError && info.isEmpty() ) {
            // This seems to be a bit strange behaviour of QNetworkAccessManager.
            // It calls the finised slot multiple times but only the first read wins.
            // That happend when the code connected the finished signal of the manager.
            // It did not happen when the code connected to the reply finish signal.
            qDebug() << "WRN: NetworkReply with not content but also no error! " << reply;
            reply->deleteLater();
            return;
        }
        qDebug() << "status.php returns: " << info << " " << reply->error() << " Reply: " << reply;
        if( info.contains(QLatin1String("installed"))
                && info.contains(QLatin1String("version"))
                && info.contains(QLatin1String("versionstring")) ) {
            info.remove(0,1); // remove first char which is a "{"
            info.remove(-1,1); // remove the last char which is a "}"
            QStringList li = info.split( QLatin1Char(',') );

            QString versionStr;
            QString version;
            QString edition;

            foreach ( const QString& infoString, li ) {
                QStringList touple = infoString.split( QLatin1Char(':'));
                QString key = touple[0];
//.........这里部分代码省略.........
开发者ID:Sc1ence,项目名称:mirall,代码行数:101,代码来源:owncloudinfo.cpp


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