本文整理汇总了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();
}
示例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);
}
}
}
示例3: cancelGeolocationPermissionRequestForFrame
void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrame* webFrame, Geolocation* listener)
{
m_pendingPermissionRequests.remove(webFrame);
QWebPage* page = webFrame->page();
emit page->featurePermissionRequestCanceled(webFrame, QWebPage::Geolocation);
}
示例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);
}
}
示例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
}
示例6: viewportSize
QSize QWebPageProto::viewportSize() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->viewportSize();
return QSize();
}
示例7: event
// Reimplemented Public Functions
bool QWebPageProto::event(QEvent * ev)
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->event(ev);
return false;
}
示例8: selectedText
QString QWebPageProto::selectedText() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->selectedText();
return QString();
}
示例9: settings
QWebSettings* QWebPageProto::settings() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->settings();
return 0;
}
示例10: pluginFactory
QWebPluginFactory* QWebPageProto::pluginFactory() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->pluginFactory();
return 0;
}
示例11: preferredContentsSize
QSize QWebPageProto::preferredContentsSize() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->preferredContentsSize();
return QSize();
}
示例12: palette
QPalette QWebPageProto::palette() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->palette();
return QPalette();
}
示例13: networkAccessManager
QNetworkAccessManager* QWebPageProto::networkAccessManager() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->networkAccessManager();
return 0;
}
示例14: mainFrame
QWebFrame* QWebPageProto::mainFrame() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->mainFrame();
return 0;
}
示例15: view
QWidget* QWebPageProto::view() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->view();
return 0;
}