当前位置: 首页>>代码示例>>C++>>正文


C++ QWebFrame::geometry方法代码示例

本文整理汇总了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);
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例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;
}
开发者ID:nhinze,项目名称:rhodes,代码行数:26,代码来源:qtscrollerfilter.cpp

示例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();
}
开发者ID:xtuple,项目名称:qt-client,代码行数:8,代码来源:qwebframeproto.cpp

示例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;
}
开发者ID:mlapshin,项目名称:revisor,代码行数:40,代码来源:session_tab.cpp

示例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;
        }
    }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例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;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:16,代码来源:jsobjects.cpp

示例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;
}
开发者ID:BadAllOff,项目名称:capybara-webkit,代码行数:24,代码来源:JavascriptInvocation.cpp

示例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()));
 }
开发者ID:,项目名称:,代码行数:6,代码来源:


注:本文中的QWebFrame::geometry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。