本文整理汇总了C++中QWebPage::supportsExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebPage::supportsExtension方法的具体用法?C++ QWebPage::supportsExtension怎么用?C++ QWebPage::supportsExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebPage
的用法示例。
在下文中一共展示了QWebPage::supportsExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: callErrorPageExtension
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);
}
}
示例2: supportsExtension
bool QWebPageProto::supportsExtension(QWebPage::Extension extension) const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->supportsExtension(extension);
return false;
}