本文整理汇总了C++中QWebFrame::parentFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebFrame::parentFrame方法的具体用法?C++ QWebFrame::parentFrame怎么用?C++ QWebFrame::parentFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebFrame
的用法示例。
在下文中一共展示了QWebFrame::parentFrame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleUrlChanged
void FrameInit::handleUrlChanged(const QUrl &url)
{
qDebug() << "url changed frame " << m_frame->frameName() << " " << url;
qDebug() << " height = " << m_frame->geometry().height();
qDebug() << " width = " << m_frame->geometry().width();
QPoint p = m_frame->pos();
QWebFrame *frame = m_frame;
while(frame->parentFrame() != NULL) {
frame = frame->parentFrame();
p += frame->pos();
}
qDebug() << " pos = " << p;
}
示例2: while
QWebFrame *QtScrollerFilter::scrollingFrameAt_QWebView(QWebView *view, const QPoint &pos) const
{
if (!view->page())
return 0;
QWebFrame *mainFrame = view->page()->mainFrame();
QWebHitTestResult hitTest = mainFrame->hitTestContent(pos);
QWebFrame *hitFrame = hitTest.frame();
if (!hitFrame)
return 0;
QRect vsbrect = hitFrame->scrollBarGeometry(Qt::Vertical);
QRect hsbrect = hitFrame->scrollBarGeometry(Qt::Horizontal);
if (!vsbrect.isEmpty() && vsbrect.contains(hitTest.pos() - hitFrame->scrollPosition()))
return 0;
if (!hsbrect.isEmpty() && hsbrect.contains(hitTest.pos() - hitFrame->scrollPosition()))
return 0;
QSize range = hitFrame->contentsSize() - hitFrame->geometry().size();
while (hitFrame && range.width() <= 1 && range.height() <= 1)
hitFrame = hitFrame->parentFrame();
return hitFrame;
}
示例3: parentFrame
QWebFrame* QWebFrameProto::parentFrame() const
{
scriptDeprecated("QWebFrame will not be available in future versions");
QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject());
if (item)
return item->parentFrame();
return 0;
}
示例4: handleFrameLayoutComplete
void FrameInit::handleFrameLayoutComplete()
{
QString str;
str += QString("%1,%2,%3,%4,").arg(m_frame->geometry().height())
.arg(m_frame->geometry().width())
.arg(m_frame->geometry().x())
.arg(m_frame->geometry().y());
str += m_frame->frameName();
//qDebug() << "frameLayoutComplete" << m_frame->frameName() << " " << m_frame->url() << ", " << str;
OPNET::OpNetwork::instance()->sendSysCall(MSG_EMBED_FRAME, 1, str.toAscii());
QPoint p = m_frame->pos();
QWebFrame *frame = m_frame;
while(frame->parentFrame() != NULL) {
frame = frame->parentFrame();
p += frame->pos();
}
//qDebug() << " pos = " << p;
}
示例5: scrollingFrameAt
// Returns the innermost frame at the given position that can scroll.
QWebFrame* scrollingFrameAt(const QPoint& pos) const
{
QWebFrame* hitFrame = 0;
if (m_view) {
QWebFrame* frame = m_view->page()->mainFrame();
hitFrame = frame->hitTestContent(pos).frame();
QSize range = hitFrame->contentsSize() - hitFrame->geometry().size();
while (hitFrame && range.width() <= 1 && range.height() <= 1)
hitFrame = hitFrame->parentFrame();
return hitFrame;
}
}
示例6: clickPosition
QVariantMap JavascriptInvocation::clickPosition(QWebElement element, int left, int top, int width, int height) {
QRect elementBox(left, top, width, height);
QRect viewport(QPoint(0, 0), m_page->viewportSize());
QRect boundedBox = elementBox.intersected(viewport);
QPoint mousePos = boundedBox.center();
QVariantMap m;
m["relativeX"] = mousePos.x();
m["relativeY"] = mousePos.y();
QWebFrame *parent = element.webFrame();
while (parent) {
elementBox.translate(parent->geometry().topLeft());
parent = parent->parentFrame();
}
boundedBox = elementBox.intersected(viewport);
mousePos = boundedBox.center();
m["absoluteX"] = mousePos.x();
m["absoluteY"] = mousePos.y();
return m;
}
示例7: slotLinkHovered
void KWebKitPart::slotLinkHovered(const QString& _link, const QString& /*title*/, const QString& /*content*/)
{
QString message;
if (_link.isEmpty()) {
message = QL1S("");
emit m_browserExtension->mouseOverInfo(KFileItem());
} else {
QUrl linkUrl (_link);
const QString scheme = linkUrl.scheme();
// Protect the user against URL spoofing!
linkUrl.setUserName(QString());
const QString link (linkUrl.toString());
if (QString::compare(scheme, QL1S("mailto"), Qt::CaseInsensitive) == 0) {
message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", "Email: ");
// Workaround: for QUrl's parsing deficiencies of "mailto:[email protected]".
if (!linkUrl.hasQuery())
linkUrl = QUrl(scheme + '?' + linkUrl.path());
QMap<QString, QStringList> fields;
QList<QPair<QString, QString> > queryItems = linkUrl.queryItems();
const int count = queryItems.count();
for(int i = 0; i < count; ++i) {
const QPair<QString, QString> queryItem (queryItems.at(i));
//kDebug() << "query: " << queryItem.first << queryItem.second;
if (queryItem.first.contains(QL1C('@')) && queryItem.second.isEmpty())
fields["to"] << queryItem.first;
if (QString::compare(queryItem.first, QL1S("to"), Qt::CaseInsensitive) == 0)
fields["to"] << queryItem.second;
if (QString::compare(queryItem.first, QL1S("cc"), Qt::CaseInsensitive) == 0)
fields["cc"] << queryItem.second;
if (QString::compare(queryItem.first, QL1S("bcc"), Qt::CaseInsensitive) == 0)
fields["bcc"] << queryItem.second;
if (QString::compare(queryItem.first, QL1S("subject"), Qt::CaseInsensitive) == 0)
fields["subject"] << queryItem.second;
}
if (fields.contains(QL1S("to")))
message += fields.value(QL1S("to")).join(QL1S(", "));
if (fields.contains(QL1S("cc")))
message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", " - CC: ") + fields.value(QL1S("cc")).join(QL1S(", "));
if (fields.contains(QL1S("bcc")))
message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", " - BCC: ") + fields.value(QL1S("bcc")).join(QL1S(", "));
if (fields.contains(QL1S("subject")))
message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", " - Subject: ") + fields.value(QL1S("subject")).join(QL1S(" "));
} else if (scheme == QL1S("javascript")) {
message = KStringHandler::rsqueeze(link, 150);
if (link.startsWith(QL1S("javascript:window.open")))
message += i18n(" (In new window)");
} else {
message = link;
QWebFrame* frame = page() ? page()->currentFrame() : 0;
if (frame) {
QWebHitTestResult result = frame->hitTestContent(page()->view()->mapFromGlobal(QCursor::pos()));
QWebFrame* target = result.linkTargetFrame();
if (frame->parentFrame() && target == frame->parentFrame()) {
message += i18n(" (In parent frame)");
} else if (!target || target != frame) {
message += i18n(" (In new window)");
}
}
KFileItem item (linkUrl, QString(), KFileItem::Unknown);
emit m_browserExtension->mouseOverInfo(item);
}
}
emit setStatusBarText(message);
}