本文整理汇总了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;
}
示例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: 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();
}
示例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;
}