本文整理汇总了C++中QWebFrame::page方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebFrame::page方法的具体用法?C++ QWebFrame::page怎么用?C++ QWebFrame::page使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebFrame
的用法示例。
在下文中一共展示了QWebFrame::page方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: page
QWebPage* QWebFrameProto::page() const
{
scriptDeprecated("QWebFrame will not be available in future versions");
QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject());
if (item)
return item->page();
return 0;
}
示例2: cookieJar
static QNetworkCookieJar* cookieJar(QObject* originatingFrame)
{
if (!originatingFrame)
return 0;
QWebFrame* frame = qobject_cast<QWebFrame*>(originatingFrame);
if (!frame)
return 0;
QNetworkAccessManager* manager = frame->page()->networkAccessManager();
QNetworkCookieJar* jar = manager->cookieJar();
return jar;
}
示例3:
static QNetworkCookieJar *cookieJar(const Document *document)
{
Frame *frame = document->frame();
if (!frame)
return 0;
FrameLoader *loader = frame->loader();
if (!loader)
return 0;
QWebFrame* webFrame = static_cast<FrameLoaderClientQt*>(loader->client())->webFrame();
QWebPage* page = webFrame->page();
QNetworkAccessManager* manager = page->networkAccessManager();
QNetworkCookieJar* jar = manager->cookieJar();
return jar;
}
示例4: drtDescriptionSuitableForTestResult
// Compare with WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm
static QString drtDescriptionSuitableForTestResult(WebCore::Frame* _frame)
{
QWebFrame* frame = QWebFramePrivate::kit(_frame);
QString name = frame->frameName();
bool isMainFrame = frame == frame->page()->mainFrame();
if (isMainFrame) {
if (!name.isEmpty())
return QString::fromLatin1("main frame \"%1\"").arg(name);
return QLatin1String("main frame");
} else {
if (!name.isEmpty())
return QString::fromLatin1("frame \"%1\"").arg(name);
return QLatin1String("frame (anonymous)");
}
}
示例5: slotMainFrameLoadFinished
void KWebKitPart::slotMainFrameLoadFinished (bool ok)
{
if (!ok || !m_doLoadFinishedActions)
return;
m_doLoadFinishedActions = false;
if (!m_emitOpenUrlNotify) {
m_emitOpenUrlNotify = true; // Save history once page loading is done.
}
// If the document contains no <title> tag, then set it to the current url.
if (m_webView->title().trimmed().isEmpty()) {
// If the document title is empty, then set it to the current url
const QUrl url (m_webView->url());
const QString caption (url.toString((QUrl::RemoveQuery|QUrl::RemoveFragment)));
emit setWindowCaption(caption);
// The urlChanged signal is emitted if and only if the main frame
// receives the title of the page so we manually invoke the slot as a
// work around here for pages that do not contain it, such as text
// documents...
slotUrlChanged(url);
}
QWebFrame* frame = page()->mainFrame();
if (!frame || frame->url() == *globalBlankUrl)
return;
// Set the favicon specified through the <link> tag...
if (WebKitSettings::self()->favIconsEnabled()
&& !frame->page()->settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
const QWebElement element = frame->findFirstElement(QL1S("head>link[rel=icon], "
"head>link[rel=\"shortcut icon\"]"));
QUrl shortcutIconUrl;
if (!element.isNull()) {
shortcutIconUrl = frame->baseUrl().resolved(QUrl(element.attribute("href")));
//kDebug() << "setting favicon to" << shortcutIconUrl;
m_browserExtension->setIconUrl(shortcutIconUrl);
}
}
slotFrameLoadFinished(ok);
}
示例6: set_repaint_throttle
bool PropertyChanger::set_repaint_throttle(QString value)
{
QWebFrame* pFrame = static_cast < QWebFrame* > ( this->parent() );
QWebPage* pPage = NULL;
if ( pFrame != NULL )
pPage = pFrame->page();
else
return false;
if ( pPage == NULL )
return false;
//TODO: check values
pPage->setProperty("_q_RepaintThrottlingPreset", value);
return true;
}
示例7: slotLoadFinished
void KWebKitPart::slotLoadFinished(bool ok)
{
bool pending = false;
if (m_doLoadFinishedActions) {
updateActions();
QWebFrame* frame = (page() ? page()->currentFrame() : 0);
if (ok &&
frame == page()->mainFrame() &&
!frame->findFirstElement(QL1S("head>meta[http-equiv=refresh]")).isNull()) {
if (WebKitSettings::self()->autoPageRefresh()) {
pending = true;
} else {
frame->page()->triggerAction(QWebPage::StopScheduledPageRefresh);
}
}
}
emit completed ((ok && pending));
}
示例8: cancelRequestsForPermission
void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionContext* context)
{
m_cachedPermissions.remove(context);
QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context);
if (iter == m_pendingPermissionRequests.end())
return;
QWebFrame* frame = iter.value().m_frame;
if (!frame)
return;
QWebPage* page = frame->page();
m_pendingPermissionRequests.erase(iter);
if (!page)
return;
if (dumpNotification)
printf("DESKTOP NOTIFICATION PERMISSION REQUEST CANCELLED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData());
emit page->featurePermissionRequestCanceled(frame, QWebPage::Notifications);
}