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


C++ QWebPage类代码示例

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


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

示例1: linkDelegationPolicy

QWebPage::LinkDelegationPolicy QWebPageProto::linkDelegationPolicy() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->linkDelegationPolicy();
  return QWebPage::LinkDelegationPolicy();
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例2: QWebPage

QList<webFileUtils::webFile> webFileUtils::getWebFiles(QUrl url)
{
    QList<webFileUtils::webFile> list;
    QWebPage *webPage = new QWebPage(this);
    QEventLoop loop;
    connect(webPage->mainFrame(), SIGNAL(loadFinished(bool)), &loop, SLOT(quit()));
    webPage->mainFrame()->load(url);
    loop.exec();
    QUrl baseUrl = webPage->mainFrame()->baseUrl();

    QWebElementCollection collection = webPage->mainFrame()->findAllElements("a");
    foreach (QWebElement element, collection)
    {
        QString href = element.attribute("href");
        if (!href.isEmpty())
        {
            QUrl relativeUrl(href);
            QUrl absoluteUrl = baseUrl.resolved(relativeUrl);
            if(element.toPlainText().contains("exe") | element.toPlainText().contains("tar.xz") | element.toPlainText().contains("zip")) {
                webFile file;
                file.name = element.toPlainText();
                file.url = absoluteUrl;
                list.append(file);
            }
        }
    }
开发者ID:JBTecnologia,项目名称:ReleaseBuilder,代码行数:26,代码来源:webfileutils.cpp

示例3: cancelGeolocationPermissionRequestForFrame

void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrame* webFrame, Geolocation* listener)
{
    m_pendingPermissionRequests.remove(webFrame);

    QWebPage* page = webFrame->page();
    emit page->featurePermissionRequestCanceled(webFrame, QWebPage::Geolocation);
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:7,代码来源:GeolocationPermissionClientQt.cpp

示例4: if

void FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error)
{
    QWebPage* page = m_webFrame->page();
    if (page->supportsExtension(QWebPage::ErrorPageExtension)) {
        QWebPage::ErrorPageExtensionOption option;

        if (error.domain() == "QtNetwork")
            option.domain = QWebPage::QtNetwork;
        else if (error.domain() == "HTTP")
            option.domain = QWebPage::Http;
        else if (error.domain() == "WebKit")
            option.domain = QWebPage::WebKit;
        else
            return;

        option.url = QUrl(error.failingURL());
        option.frame = m_webFrame;
        option.error = error.errorCode();
        option.errorString = error.localizedDescription();

        QWebPage::ErrorPageExtensionReturn output;
        if (!page->extension(QWebPage::ErrorPageExtension, &option, &output))
            return;

        KURL baseUrl(output.baseUrl);
        KURL failingUrl(option.url);

        WebCore::ResourceRequest request(baseUrl);
        WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(output.content.constData(), output.content.length());
        WebCore::SubstituteData substituteData(buffer, output.contentType, output.encoding, failingUrl);
        m_frame->loader()->load(request, substituteData, false);
    }
}
开发者ID:Marforius,项目名称:qt,代码行数:33,代码来源:FrameLoaderClientQt.cpp

示例5: fopen

void MyTextBrowser::htmlOrSvgDump(const char *filename)
{
#ifdef NO_WEBKIT
  FILE *fout = fopen(filename,"w");
  if(fout == NULL)
  {
    printf("could not write %s\n", filename);
    return;
  }
  QString xml = toHtml();
  fputs(xml.toUtf8(), fout);
  fclose(fout);
#else
  QWebPage *p = page();
  if(p == NULL) return;
  QWebFrame *f = p->currentFrame();
  if(f == NULL) return;

  FILE *fout = fopen(filename,"w");
  if(fout == NULL)
  {
    printf("could not write %s\n", filename);
    return;
  }
  QString xml = f->toHtml();
  fputs(xml.toUtf8(), fout);
  fclose(fout);
#endif  
}
开发者ID:pvbrowser,项目名称:pvb,代码行数:29,代码来源:MyTextBrowser_v4.cpp

示例6: viewportSize

QSize QWebPageProto::viewportSize() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->viewportSize();
  return QSize();
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例7: event

// Reimplemented Public Functions
bool QWebPageProto::event(QEvent * ev)
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->event(ev);
  return false;
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:8,代码来源:qwebpageproto.cpp

示例8: selectedText

QString QWebPageProto::selectedText() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->selectedText();
  return QString();
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例9: settings

QWebSettings* QWebPageProto::settings() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->settings();
  return 0;
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例10: pluginFactory

QWebPluginFactory* QWebPageProto::pluginFactory() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->pluginFactory();
  return 0;
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例11: preferredContentsSize

QSize QWebPageProto::preferredContentsSize() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->preferredContentsSize();
  return QSize();
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例12: palette

QPalette QWebPageProto::palette() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->palette();
  return QPalette();
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例13: networkAccessManager

QNetworkAccessManager* QWebPageProto::networkAccessManager() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->networkAccessManager();
  return 0;
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例14: mainFrame

QWebFrame* QWebPageProto::mainFrame() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->mainFrame();
  return 0;
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp

示例15: view

QWidget* QWebPageProto::view() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->view();
  return 0;
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:7,代码来源:qwebpageproto.cpp


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