本文整理汇总了C++中QWebFrame::geometry方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebFrame::geometry方法的具体用法?C++ QWebFrame::geometry怎么用?C++ QWebFrame::geometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebFrame
的用法示例。
在下文中一共展示了QWebFrame::geometry方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
message_view::page_down()
{
QWebFrame* frame = m_bodyv->page()->mainFrame();
if (!frame)
return;
QPoint pos = frame->scrollPosition();
int y = m_bodyv->geometry().height() + pos.y();
if (y > frame->contentsSize().height()-frame->geometry().height())
y = frame->contentsSize().height()-frame->geometry().height();
pos.setY(y);
frame->setScrollPosition(pos);
}
示例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: geometry
QRect QWebFrameProto::geometry() const
{
scriptDeprecated("QWebFrame will not be available in future versions");
QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject());
if (item)
return item->geometry();
return QRect();
}
示例4: sendMouseEvent
bool SessionTab::sendMouseEvent(QMouseEvent::Type type, const QPoint& point, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
{
QWebFrame* frame = webPage->mainFrame();
QPoint relativePoint;
unsigned int scrollX = 0;
unsigned int scrollY = 0;
QPoint savedScrollPos = frame->scrollPosition();
unsigned int w = frame->geometry().width() - frame->scrollBarGeometry(Qt::Vertical).width();
unsigned int h = frame->geometry().height() - frame->scrollBarGeometry(Qt::Horizontal).height();
// unsigned int maxScrollX = frame->scrollBarMaximum(Qt::Horizontal);
// unsigned int maxScrollY = frame->scrollBarMaximum(Qt::Vertical);
if (point.x() > (w - 1)) {
scrollX = point.x() - w + 1;
relativePoint.setX(w - 1);
} else {
relativePoint.setX(point.x());
}
if (point.y() > (h - 1)) {
scrollY = point.y() - h + 1;
relativePoint.setY(h - 1);
} else {
relativePoint.setY(point.y());
}
QMouseEvent event(type, relativePoint, button, buttons, modifiers);
frame->setScrollPosition(QPoint(scrollX, scrollY));
bool ret = sendEvent(&event);
qDebug() << "Mouse event" << type << relativePoint;
frame->setScrollPosition(savedScrollPos);
return ret;
}
示例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:
QWebFrame *EventSender::frameUnderMouse() const
{
QWebFrame *frame = m_page->mainFrame();
redo:
QList<QWebFrame*> children = frame->childFrames();
for (int i = 0; i < children.size(); ++i) {
if (children.at(i)->geometry().contains(m_mousePos)) {
frame = children.at(i);
goto redo;
}
}
if (frame->geometry().contains(m_mousePos))
return frame;
return 0;
}
示例7: 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;
}
示例8: maximumScrollPosition
QPoint maximumScrollPosition() const
{
QWebFrame* frame = currentFrame();
QSize s = frame ? frame->contentsSize() - frame->geometry().size() : QSize(0, 0);
return QPoint(qMax(0, s.width()), qMax(0, s.height()));
}