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


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

本文整理汇总了C++中QWebFrame::scrollBarGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebFrame::scrollBarGeometry方法的具体用法?C++ QWebFrame::scrollBarGeometry怎么用?C++ QWebFrame::scrollBarGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWebFrame的用法示例。


在下文中一共展示了QWebFrame::scrollBarGeometry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mousePress

bool MouseGestures::mousePress(QObject* obj, QMouseEvent* event)
{
    m_view = qobject_cast<WebView*>(obj);

    QWebFrame* frame = m_view.data()->page()->mainFrame();

    if (frame->scrollBarGeometry(Qt::Vertical).contains(event->pos()) ||
        frame->scrollBarGeometry(Qt::Horizontal).contains(event->pos())
       ) {
        return false;
    }

    if (m_enableRockerNavigation && event->buttons() == (Qt::RightButton | Qt::LeftButton)) {
        bool accepted = false;

        if (event->button() == Qt::LeftButton && m_view.data()->history()->canGoBack()) {
            m_view.data()->back();
            accepted = true;
        }
        else if (event->button() == Qt::RightButton && m_view.data()->history()->canGoForward()) {
            m_view.data()->forward();
            accepted = true;
        }

        if (accepted) {
            m_blockNextLeftMouseRelease = true;
            m_blockNextRightMouseRelease = true;
            return true;
        }
    }

    m_filter->mouseButtonPressEvent(event);

    return false;
}
开发者ID:AlexTalker,项目名称:qupzilla,代码行数:35,代码来源:mousegestures.cpp

示例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: scrollBarGeometry

QRect QWebFrameProto::scrollBarGeometry(Qt::Orientation orientation) const
{
  scriptDeprecated("QWebFrame will not be available in future versions");
  QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject());
  if (item)
    return item->scrollBarGeometry(orientation);
  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


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