本文整理汇总了C++中QWebPage::currentFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebPage::currentFrame方法的具体用法?C++ QWebPage::currentFrame怎么用?C++ QWebPage::currentFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebPage
的用法示例。
在下文中一共展示了QWebPage::currentFrame方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: htmlOrSvgDump
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
}
示例2: currentFrame
QWebFrame* QWebPageProto::currentFrame() const
{
QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
if (item)
return item->currentFrame();
return 0;
}
示例3: _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)
示例4: tbScrollToAnchor
void MyTextBrowser::tbScrollToAnchor(QString &text)
{
#ifdef NO_WEBKIT
scrollToAnchor(text);
#else
QWebPage *pageptr = page();
if(pageptr != NULL)
{
pageptr->currentFrame()->scrollToAnchor(text);
}
#endif
}
示例5: renderPageTo
void Viewer::renderPageTo(QImage* image)
{
QWebPage *page = webView->page();
QWebFrame *frame = page->currentFrame();
QSize origSize = page->viewportSize();
page->setViewportSize(frame->contentsSize());
QPainter painter(image);
frame->render(&painter);
painter.end();
page->setViewportSize(origSize);
}
示例6: slotLoadFinished
void dlgMyBrowser::slotLoadFinished(bool ok)
{
if(opt.arg_debug) printf("dlgMyBrowser:slotLoadFinished(%d)\n", (int) ok);
if(ok == false) return;
#ifdef USE_WEBKIT
if(opt.arg_debug) printf("dlgMyBrowser::slotLoadFinshed anchor=%s\n", (const char *) anchor.toUtf8());
#if QT_VERSION >= 0x040700
if(anchor.length() > 0)
{
QWebPage *page = form->browser->page();
if(page != NULL)
{
if(opt.arg_debug) printf("dlgMyBrowser::slotLoadFinshed scrollToAnchor\n");
page->currentFrame()->scrollToAnchor(anchor);
}
}
#endif
#endif
}