本文整理汇总了C++中PlatformMouseEvent::globalX方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformMouseEvent::globalX方法的具体用法?C++ PlatformMouseEvent::globalX怎么用?C++ PlatformMouseEvent::globalX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlatformMouseEvent
的用法示例。
在下文中一共展示了PlatformMouseEvent::globalX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
{
ASSERT(event.eventType() == MouseEventMoved || event.button() != NoButton);
bool isCancelable = eventType != eventNames().mousemoveEvent;
return MouseEvent::create(eventType, true, isCancelable, view,
detail, event.globalX(), event.globalY(), event.x(), event.y(),
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
relatedTarget, 0, false);
}
示例2: dispatchMouseEvent
bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& _mouse, const AtomicString& eventType,
int detail, Node* relatedTarget)
{
assert(!eventDispatchForbidden());
IntPoint contentsPos;
if (FrameView* view = document()->view())
contentsPos = view->viewportToContents(_mouse.pos());
return dispatchMouseEvent(eventType, _mouse.button(), detail,
contentsPos.x(), contentsPos.y(), _mouse.globalX(), _mouse.globalY(),
_mouse.ctrlKey(), _mouse.altKey(), _mouse.shiftKey(), _mouse.metaKey(),
false, relatedTarget);
}
示例3: dispatchMouseEvent
bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicString& eventType,
int detail, Node* relatedTarget)
{
ASSERT(!eventDispatchForbidden());
IntPoint contentsPos;
if (FrameView* view = document()->view())
contentsPos = view->windowToContents(event.pos());
short button = event.button();
ASSERT(event.eventType() == MouseEventMoved || button != NoButton);
return dispatchMouseEvent(eventType, button, detail,
contentsPos.x(), contentsPos.y(), event.globalX(), event.globalY(),
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
false, relatedTarget);
}
示例4: handleContextMenuEvent
bool PlatformScrollbar::handleContextMenuEvent(const PlatformMouseEvent& event)
{
#ifndef QT_NO_CONTEXTMENU
bool horizontal = (m_orientation == HorizontalScrollbar);
QMenu menu;
QAction* actScrollHere = menu.addAction(tr("Scroll here"));
menu.addSeparator();
QAction* actScrollTop = menu.addAction(horizontal ? tr("Left edge") : tr("Top"));
QAction* actScrollBottom = menu.addAction(horizontal ? tr("Right edge") : tr("Bottom"));
menu.addSeparator();
QAction* actPageUp = menu.addAction(horizontal ? tr("Page left") : tr("Page up"));
QAction* actPageDown = menu.addAction(horizontal ? tr("Page right") : tr("Page down"));
menu.addSeparator();
QAction* actScrollUp = menu.addAction(horizontal ? tr("Scroll left") : tr("Scroll up"));
QAction* actScrollDown = menu.addAction(horizontal ? tr("Scroll right") : tr("Scroll down"));
const QPoint globalPos = QPoint(event.globalX(), event.globalY());
QAction* actionSelected = menu.exec(globalPos);
if (actionSelected == 0)
/* Do nothing */ ;
else if (actionSelected == actScrollHere) {
const QPoint pos = convertFromContainingWindow(event.pos());
setValue(pixelPosToRangeValue(horizontal ? pos.x() : pos.y()));
} else if (actionSelected == actScrollTop)
setValue(0);
else if (actionSelected == actScrollBottom)
setValue(m_totalSize - m_visibleSize);
else if (actionSelected == actPageUp)
scroll(horizontal ? ScrollLeft: ScrollUp, ScrollByPage, 1);
else if (actionSelected == actPageDown)
scroll(horizontal ? ScrollRight : ScrollDown, ScrollByPage, 1);
else if (actionSelected == actScrollUp)
scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByLine, 1);
else if (actionSelected == actScrollDown)
scroll(horizontal ? ScrollRight : ScrollDown, ScrollByLine, 1);
#endif // QT_NO_CONTEXTMENU
return true;
}