QSinglePointEvent Class

A base class for pointer events containing a single point, such as mouse events. 更多...

頭: #include <QSinglePointEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Since: Qt 6.0
繼承: QPointerEvent
繼承者: QEnterEvent , QHoverEvent , QMouseEvent , QNativeGestureEvent , QTabletEvent ,和 QWheelEvent

特性

公共函數

Qt::MouseButton button () const
Qt::MouseButtons buttons () const
QObject * exclusivePointGrabber () const
QPointF globalPosition () const
QPointF position () const
QPointF scenePosition () const
void setExclusivePointGrabber (QObject * exclusiveGrabber )

重實現公共函數

virtual bool isBeginEvent () const override
virtual bool isEndEvent () const override
virtual bool isUpdateEvent () const override

詳細描述

特性文檔編製

exclusivePointGrabber : QObject *

This property holds the object that will receive future updates

The exclusive grabber is an object that has chosen to receive all future update events and the release event containing the same point that this event carries.

Setting the exclusivePointGrabber property is a convenience equivalent to:

setExclusiveGrabber(points().first(), exclusiveGrabber);
					

訪問函數:

QObject * exclusivePointGrabber () const
void setExclusivePointGrabber (QObject * exclusiveGrabber )

成員函數文檔編製

Qt::MouseButton QSinglePointEvent:: button () const

返迴導緻事件的按鈕。

The returned value is always Qt::NoButton for mouse move events, as well as TabletMove , TabletEnterProximity ,和 TabletLeaveProximity 事件。

另請參閱 buttons ().

Qt::MouseButtons QSinglePointEvent:: buttons () const

Returns the button state when the event was generated.

The button state is a combination of Qt::LeftButton , Qt::RightButton ,和 Qt::MiddleButton using the OR operator.

For mouse move or TabletMove events, this is all buttons that are pressed down.

For mouse press, double click, or TabletPress events, this includes the button that caused the event.

For mouse release or TabletRelease events, this excludes the button that caused the event.

另請參閱 button ().

QPointF QSinglePointEvent:: globalPosition () const

Returns the position of the point in this event on the screen or virtual desktop.

注意: The global position of a mouse pointer is recorded 當事件發生時 。這對異步窗口係統 (譬如 X11) 很重要;每當圍繞響應鼠標事件移動 Widget 時,globalposition() 會非常不同於當前光標位置返迴通過 QCursor::pos ().

另請參閱 position ().

[override virtual] bool QSinglePointEvent:: isBeginEvent () const

返迴 true if this event represents a button being pressed.

[override virtual] bool QSinglePointEvent:: isEndEvent () const

返迴 true if this event represents a button being released.

[override virtual] bool QSinglePointEvent:: isUpdateEvent () const

返迴 true if this event does not include a change in button state .

QPointF QSinglePointEvent:: position () const

Returns the position of the point in this event, relative to the widget or item that received the event.

若圍繞響應鼠標事件移動 Widget,使用 globalPosition () 代替。

另請參閱 globalPosition ().

QPointF QSinglePointEvent:: scenePosition () const

Returns the position of the point in this event, relative to the window or scene.

另請參閱 QEventPoint::scenePosition .