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 |
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 ) |
返回导致事件的按钮。
The returned value is always Qt::NoButton for mouse move events, as well as TabletMove , TabletEnterProximity ,和 TabletLeaveProximity 事件。
另请参阅 buttons ().
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 ().
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
.
Returns the position of the point in this event, relative to the widget or item that received the event.
若围绕响应鼠标事件移动 Widget,使用 globalPosition () 代替。
另请参阅 globalPosition ().
Returns the position of the point in this event, relative to the window or scene.
另请参阅 QEventPoint::scenePosition .