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


C++ QWebElement::findAll方法代码示例

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


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

示例1: getElementById

  QList <QWebElement> ChromeDOM::getInitialElements()
  {
    m_renderer->clearRenderList();
    QWebElement test = getElementById("TestTableCell9");
    //qDebug() << "TEST ELEMENT:" << test.toPlainText();
    m_height = 0;
    QWebElement doc = m_page->mainFrame()->documentElement();
#if QT_VERSION < 0x040600 //TBD: Do we care, given that the dom api is not officially supported before 4.6?
    return doc.findAll(".GinebraSnippet");
#else
    return doc.findAll(".GinebraSnippet").toList();
#endif
  }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:13,代码来源:ChromeDOM.cpp

示例2: findElement

void ClickToFlash::findElement()
{
  if (!loadButton_)
    return;

  QPoint objectPos = page_->view()->mapFromGlobal(loadButton_->mapToGlobal(loadButton_->pos()));
  QWebFrame* objectFrame = page_->frameAt(objectPos);
  QWebHitTestResult hitResult;
  QWebElement hitElement;

  if (objectFrame) {
    hitResult = objectFrame->hitTestContent(objectPos);
    hitElement = hitResult.element();
  }

  if (!hitElement.isNull() && (hitElement.tagName().compare("embed", Qt::CaseInsensitive) == 0 ||
                               hitElement.tagName().compare("object", Qt::CaseInsensitive) == 0)) {
    element_ = hitElement;
    return;
  }

  // HitTestResult failed, trying to find element by src
  // attribute in elements at all frames on page (less accurate)

  QList<QWebFrame*> frames;
  frames.append(objectFrame);
  frames.append(page_->mainFrame());

  while (!frames.isEmpty()) {
    QWebFrame* frame = frames.takeFirst();
    if (!frame) {
      continue;
    }
    QWebElement docElement = frame->documentElement();

    QWebElementCollection elements;
    elements.append(docElement.findAll(QLatin1String("embed")));
    elements.append(docElement.findAll(QLatin1String("object")));

    foreach (const QWebElement &element, elements) {
      if (!checkElement(element) && !checkUrlOnElement(element)) {
        continue;
      }
      element_ = element;
      return;
    }
    frames += frame->childFrames();
  }
}
开发者ID:DanMan,项目名称:quiterss,代码行数:49,代码来源:clicktoflash.cpp

示例3: queryLoadFinished

void FilmwebProvider::queryLoadFinished(bool ok)
{
	timeout->stop();

	if (ok)
	{
		QWebElement document = webPage->mainFrame()->documentElement();

		QWebElementCollection links = document.findAll("li.searchResult");
		foreach (QWebElement e, links)
		{
			if (e.findFirst("span.searchResultTypeAlias").toPlainText() == "film" || e.findFirst("span.searchResultTypeAlias").toPlainText() == "TV")
			{
				QString plainName = e.findFirst("a.searchResultTitle").toPlainText();

				QStringList name = plainName.split(QRegExp(" / "), QString::SkipEmptyParts);

				QString plainDetails = e.findFirst("div.searchResultDetails").toPlainText();
				QStringList details = plainDetails.split(QRegExp(" | "), QString::SkipEmptyParts);

				resultsModel->appendRow(new ResultsItem(name[0], (name.size() > 1) ? (name[1]) : (QString("")), details[0], "http://www.filmweb.pl" + e.findFirst("a.searchResultTitle").attribute("href")));
			}
		}
	}
	else
开发者ID:mattrick,项目名称:titled,代码行数:25,代码来源:FilmwebProvider.cpp

示例4: pageLoadFinished

void PIM_Handler::pageLoadFinished()
{
    WebPage* page = qobject_cast<WebPage*>(sender());
    if (!page) {
        return;
    }

    if (!m_loaded) {
        loadSettings();
    }

    const QWebElement document = page->mainFrame()->documentElement();
    const QWebElementCollection elements = document.findAll("input[type=\"text\"]");

    foreach (QWebElement element, elements) {
        const QString name = element.attribute("name");
        if (name.isEmpty()) {
            continue;
        }

        PI_Type match = nameMatch(name);
        if (match != PI_Invalid) {
            element.setStyleProperty("-webkit-appearance", "none");
            element.setStyleProperty("-webkit-box-shadow", "inset 0 0 2px 1px #EEE000");
        }
    }
}
开发者ID:593in,项目名称:qupzilla,代码行数:27,代码来源:PIM_handler.cpp

示例5: keyPress

bool PIM_Handler::keyPress(WebView* view, QKeyEvent* event)
{
    if (!view) {
        return false;
    }

    bool isEnter = event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter;
    bool isControlModifier = event->modifiers() & Qt::ControlModifier;

    if (!isEnter || !isControlModifier) {
        return false;
    }

    const QWebElement document = view->page()->mainFrame()->documentElement();
    const QWebElementCollection elements = document.findAll("input[type=\"text\"]");

    foreach (QWebElement element, elements) {
        const QString name = element.attribute("name");
        if (name.isEmpty()) {
            continue;
        }

        PI_Type match = nameMatch(name);
        if (match != PI_Invalid) {
            element.evaluateJavaScript(QString("this.value = \"%1\"").arg(m_allInfo[match]));
        }
    }

    return true;
}
开发者ID:593in,项目名称:qupzilla,代码行数:30,代码来源:PIM_handler.cpp

示例6: downloadedMangaList

void MangaherePlugin::downloadedMangaList(bool ok)
{
    if(!ok)
    {
        qDebug() << tr("There was an error loading the manga list from host 'www.mangahere.co'.");
        return;
    }

    //MangaList successfully downloaded, processing the HTML...

    m_mangaListLoaded = true;
    m_mangaList.clear();

    QWebElement element = m_pPageMangaList.mainFrame()->documentElement();
    QWebElementCollection collAllMangas = element.findAll(".manga_info");

    qDebug() << "Sample Manga:" << collAllMangas.at(0).toPlainText() << " url(" << collAllMangas.at(0).attribute("href", "ERROR") << ")";

    int i = 0;
    foreach (QWebElement oneManga, collAllMangas) {
        qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
        Manga::Simple manga;
        manga.title = oneManga.toPlainText();
        manga.url = oneManga.attribute("href", "ERROR");
        m_mangaList << manga;
        i++;
    }
开发者ID:Haellsigh,项目名称:Yamr-plugins,代码行数:27,代码来源:Mangahere.cpp

示例7: _loadFinished

void MainWindow::_loadFinished(bool ok)
{
    if (ok)
    {
        QString indexUrl = _appSettings.host();
        indexUrl += "index.php";

        QString pageUrl = ui->webView->url().toString();
        QWebPage* page = ui->webView->page();
        QWebFrame* frame = page->currentFrame();
        QWebElement root = frame->documentElement();
        if (!root.findFirst("#loginForm").isNull())
        {
            QWebElementCollection allInputs = root.findAll("input");
            foreach (QWebElement inputElement, allInputs)
            {
                if (inputElement.hasAttribute("name"))
                {
                    QString name = inputElement.attribute("name");
                    if (name == "username")
                    {
                        inputElement.setAttribute("value", _appSettings.user());
                    }
                    else if (name == "password")
                    {
                        inputElement.setAttribute("value", _appSettings.password());
                    }
                }
            }

            root.findFirst("input[type=submit]").evaluateJavaScript("this.click()");
        }
        else if (pageUrl == indexUrl)
开发者ID:fralik,项目名称:ZmKiosk,代码行数:33,代码来源:mainwindow.cpp

示例8: exportSelected

void MainWindow::exportSelected(const QString &filename)
{
	QWebElement element = ui->webViewResults->page()->mainFrame()->documentElement().clone();

	QWebElementCollection nodes;

	nodes = element.findAll("html > head > script, html > head > link, #spacer, #intro, #templates");
	foreach (QWebElement node, nodes)
		node.removeFromDocument();

	nodes = element.findAll(".selected, .unselected");
	foreach (QWebElement node, nodes)
	{
		node.removeClass("selected");
		node.removeClass("unselected");
	}
开发者ID:AlexanderLyNL,项目名称:jasp-desktop,代码行数:16,代码来源:mainwindow.cpp

示例9: foreach

    foreach (const QWebElement &selectField, selectFields) {
        QString name = selectField.attribute(QLatin1String("name"));
        int selectedIndex = selectField.scriptableProperty(QLatin1String("selectedIndex")).toInt();
        if (selectedIndex == -1)
            continue;

        QList<QWebElement> options = selectField.findAll(QLatin1String("option"));
        QString value = options.at(selectedIndex).toPlainText();
        searchUrl.addQueryItem(name, value);
    }
开发者ID:lionhearting,项目名称:arora,代码行数:10,代码来源:webview.cpp

示例10: foreach

    foreach (QWebElement selectField, selectFields) {
        QString name = selectField.attribute(QLatin1String("name"));
        int selectedIndex = selectField.evaluateJavaScript(QLatin1String("this.selectedIndex")).toInt();
        if (selectedIndex == -1)
            continue;

        QWebElementCollection options = selectField.findAll(QLatin1String("option"));
        QString value = options.at(selectedIndex).toPlainText();
        searchUrl.addQueryItem(name, value);
    }
开发者ID:mariuz,项目名称:fram,代码行数:10,代码来源:webview.cpp

示例11: render

void SexpRenderer::render()
{
    QWebElement document = page.currentFrame()->documentElement();
    QWebElementCollection allSpans = document.findAll("span");
    for (auto span : allSpans)
    {
        std::cout << "found span!" << std::endl;
    }
    emit finished();
}
开发者ID:foobar27,项目名称:qtwebkit-server,代码行数:10,代码来源:SexpRenderer.cpp

示例12: run

void HtmlThread::run()
{
    Helper::Download(this->url);
    QWebElement root;
    QString flag("False");
    emit this->ParseHtml(this->getUrl(),root,flag);
    while("True"==flag){break;}
    QWebElementCollection items;
    items = root.findAll("table");
    qDebug()<<items.count();
}
开发者ID:tinyms,项目名称:310game,代码行数:11,代码来源:HtmlThread.cpp

示例13: onMultipleGenerationFinished

void TranslationHandler::onMultipleGenerationFinished(bool ok)
{
    Request *req = m_pendingRequests.take(sender());
    if (ok && req) {
        QMultiMap<Type,QString> words;
        QWebElement table =
            req->webFrame()->findFirstElement("table");
        QWebElementCollection items = table.findAll("li");
        foreach (const QWebElement &item, items)
            words.insert(Any, item.toPlainText());
        emit generated(words);
    } else {
开发者ID:daivanov,项目名称:LangLink,代码行数:12,代码来源:translation-handler.cpp

示例14: load

void FakePluginWidget::load (bool loadAll)
{
    QWebView *view = webViewFrom(parentWidget());
    if (!view)
        return;

    // WORKAROUND: For some reason, when we load on demand plugins the scroll
    // position gets utterly screwed up and reset to the beginning of the
    // document. This is an effort to workaround that issue.
    connect(view->page(), SIGNAL(scrollRequested(int,int,QRect)),
            this, SLOT(updateScrollPoisition(int,int,QRect)), Qt::QueuedConnection);

    hide();
    m_swapping = true;

    QList<QWebFrame*> frames;
    frames.append(view->page()->mainFrame());

    QString selector (QLatin1String("applet:not([type]),embed:not([type]),object:not([type]),applet[type=\""));
    selector += m_mimeType;
    selector += QLatin1String("\"],embed[type=\"");
    selector += m_mimeType;
    selector += QLatin1String("\"],object[type=\"");
    selector += m_mimeType;
    selector += QLatin1String("\"]");

    while (!frames.isEmpty()) {
        bool loaded = false;
        QWebFrame *frame = frames.takeFirst();
        QWebElement docElement = frame->documentElement();
        QWebElementCollection elements = docElement.findAll(selector);

        Q_FOREACH (QWebElement element, elements) {
            if (loadAll || element.evaluateJavaScript(QLatin1String("this.swapping")).toBool()) {
                QWebElement substitute = element.clone();
                emit pluginLoaded(m_id);
                m_updateScrollPosition = true;
                element.replace(substitute);
                deleteLater();
                if (!loadAll) {
                    loaded = true;
                    break;  // Found the one plugin we wanted to start so exit loop.
                }
            }
        }
        if (loaded && !loadAll) {
            break;      // Loading only one item, exit the outer loop as well...
        }
        frames += frame->childFrames();
    }

    m_swapping = false;
}
开发者ID:netrunner-debian-kde-extras,项目名称:webkitkde,代码行数:53,代码来源:webpluginfactory.cpp

示例15: on_elementLineEdit_returnPressed

//! [return pressed]
void Window::on_elementLineEdit_returnPressed()
{
    QWebFrame *frame = webView->page()->mainFrame();

//! [select elements]
    QWebElement document = frame->documentElement();
    QWebElementCollection elements = document.findAll(elementLineEdit->text());
//! [select elements]

    foreach (QWebElement element, elements)
        element.setAttribute("style", "background-color: #f0f090");
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:13,代码来源:window.cpp


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