📄 qgraphicssceneevent.cpp
字号:
{ Q_D(QGraphicsSceneMouseEvent); d->lastPos = pos;}/*! Returns the last recorded mouse cursor position in scene coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event. \sa lastPos(), lastScreenPos(), scenePos()*/QPointF QGraphicsSceneMouseEvent::lastScenePos() const{ Q_D(const QGraphicsSceneMouseEvent); return d->lastScenePos;}/*! \internal*/void QGraphicsSceneMouseEvent::setLastScenePos(const QPointF &pos){ Q_D(QGraphicsSceneMouseEvent); d->lastScenePos = pos;}/*! Returns the last recorded mouse cursor position in screen coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event. \sa lastPos(), lastScenePos(), screenPos()*/QPoint QGraphicsSceneMouseEvent::lastScreenPos() const{ Q_D(const QGraphicsSceneMouseEvent); return d->lastScreenPos;}/*! \internal*/void QGraphicsSceneMouseEvent::setLastScreenPos(const QPoint &pos){ Q_D(QGraphicsSceneMouseEvent); d->lastScreenPos = pos;}/*! Returns the combination of mouse buttons that were pressed at the time the event was sent. \sa button(), modifiers()*/Qt::MouseButtons QGraphicsSceneMouseEvent::buttons() const{ Q_D(const QGraphicsSceneMouseEvent); return d->buttons;}/*! \internal*/void QGraphicsSceneMouseEvent::setButtons(Qt::MouseButtons buttons){ Q_D(QGraphicsSceneMouseEvent); d->buttons = buttons;}/*! Returns the mouse button (if any) that caused the event. \sa buttons(), modifiers()*/Qt::MouseButton QGraphicsSceneMouseEvent::button() const{ Q_D(const QGraphicsSceneMouseEvent); return d->button;}/*! \internal*/void QGraphicsSceneMouseEvent::setButton(Qt::MouseButton button){ Q_D(QGraphicsSceneMouseEvent); d->button = button;}/*! Returns the keyboard modifiers in use at the time the event was sent. \sa buttons(), button()*/Qt::KeyboardModifiers QGraphicsSceneMouseEvent::modifiers() const{ Q_D(const QGraphicsSceneMouseEvent); return d->modifiers;}/*! \internal*/void QGraphicsSceneMouseEvent::setModifiers(Qt::KeyboardModifiers modifiers){ Q_D(QGraphicsSceneMouseEvent); d->modifiers = modifiers;}class QGraphicsSceneWheelEventPrivate : public QGraphicsSceneEventPrivate{ Q_DECLARE_PUBLIC(QGraphicsSceneWheelEvent)public: inline QGraphicsSceneWheelEventPrivate() : buttons(0), modifiers(0), delta(0), orientation(Qt::Horizontal) { } QPointF pos; QPointF scenePos; QPoint screenPos; Qt::MouseButtons buttons; Qt::KeyboardModifiers modifiers; int delta; Qt::Orientation orientation;};/*! \internal Constructs a QGraphicsSceneWheelEvent of type \a type, which is always QEvent::GraphicsSceneWheel.*/QGraphicsSceneWheelEvent::QGraphicsSceneWheelEvent(Type type) : QGraphicsSceneEvent(*new QGraphicsSceneWheelEventPrivate, type){}/*! Destroys the QGraphicsSceneWheelEvent.*/QGraphicsSceneWheelEvent::~QGraphicsSceneWheelEvent(){}/*! Returns the position of the cursor in item coordinates when the wheel event occurred. \sa scenePos(), screenPos()*/QPointF QGraphicsSceneWheelEvent::pos() const{ Q_D(const QGraphicsSceneWheelEvent); return d->pos;}/*! \internal*/void QGraphicsSceneWheelEvent::setPos(const QPointF &pos){ Q_D(QGraphicsSceneWheelEvent); d->pos = pos;}/*! Returns the position of the cursor in item coordinates when the wheel event occurred. \sa pos(), screenPos()*/QPointF QGraphicsSceneWheelEvent::scenePos() const{ Q_D(const QGraphicsSceneWheelEvent); return d->scenePos;}/*! \internal*/void QGraphicsSceneWheelEvent::setScenePos(const QPointF &pos){ Q_D(QGraphicsSceneWheelEvent); d->scenePos = pos;}/*! Returns the position of the cursor in screen coordinates when the wheel event occurred. \sa pos(), scenePos()*/QPoint QGraphicsSceneWheelEvent::screenPos() const{ Q_D(const QGraphicsSceneWheelEvent); return d->screenPos;}/*! \internal*/void QGraphicsSceneWheelEvent::setScreenPos(const QPoint &pos){ Q_D(QGraphicsSceneWheelEvent); d->screenPos = pos;}/*! Returns the mouse buttons that were pressed when the wheel event occurred. \sa modifiers()*/Qt::MouseButtons QGraphicsSceneWheelEvent::buttons() const{ Q_D(const QGraphicsSceneWheelEvent); return d->buttons;}/*! \internal*/void QGraphicsSceneWheelEvent::setButtons(Qt::MouseButtons buttons){ Q_D(QGraphicsSceneWheelEvent); d->buttons = buttons;}/*! Returns the keyboard modifiers that were active when the wheel event occurred. \sa buttons()*/Qt::KeyboardModifiers QGraphicsSceneWheelEvent::modifiers() const{ Q_D(const QGraphicsSceneWheelEvent); return d->modifiers;}/*! \internal*/void QGraphicsSceneWheelEvent::setModifiers(Qt::KeyboardModifiers modifiers){ Q_D(QGraphicsSceneWheelEvent); d->modifiers = modifiers;}/*! Returns the distance that the wheel is rotated, in eighths (1/8s) of a degree. A positive value indicates that the wheel was rotated forwards away from the user; a negative value indicates that the wheel was rotated backwards toward the user. Most mouse types work in steps of 15 degrees, in which case the delta value is a multiple of 120 (== 15 * 8).*/int QGraphicsSceneWheelEvent::delta() const{ Q_D(const QGraphicsSceneWheelEvent); return d->delta;}/*! \internal*/void QGraphicsSceneWheelEvent::setDelta(int delta){ Q_D(QGraphicsSceneWheelEvent); d->delta = delta;}/*! Returns the wheel orientation.*/Qt::Orientation QGraphicsSceneWheelEvent::orientation() const{ Q_D(const QGraphicsSceneWheelEvent); return d->orientation;}/*! \internal*/void QGraphicsSceneWheelEvent::setOrientation(Qt::Orientation orientation){ Q_D(QGraphicsSceneWheelEvent); d->orientation = orientation;}class QGraphicsSceneContextMenuEventPrivate : public QGraphicsSceneEventPrivate{ Q_DECLARE_PUBLIC(QGraphicsSceneContextMenuEvent) public: inline QGraphicsSceneContextMenuEventPrivate() : modifiers(0), reason(QGraphicsSceneContextMenuEvent::Other) { } QPointF pos; QPointF scenePos; QPoint screenPos; Qt::KeyboardModifiers modifiers; QGraphicsSceneContextMenuEvent::Reason reason;};/*! \internal Constructs a graphics scene context menu event of the specified \a type.*/QGraphicsSceneContextMenuEvent::QGraphicsSceneContextMenuEvent(Type type) : QGraphicsSceneEvent(*new QGraphicsSceneContextMenuEventPrivate, type){}/*! Destroys the event.*/QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent(){}/*! Returns the position of the mouse cursor in item coordinates at the moment the the context menu was requested. \sa scenePos(), screenPos()*/QPointF QGraphicsSceneContextMenuEvent::pos() const{ Q_D(const QGraphicsSceneContextMenuEvent); return d->pos;}/*! \fn void QGraphicsSceneContextMenuEvent::setPos(const QPointF &point) \internal Sets the position associated with the context menu to the given \a point in item coordinates.*/void QGraphicsSceneContextMenuEvent::setPos(const QPointF &pos){ Q_D(QGraphicsSceneContextMenuEvent); d->pos = pos;}/*! Returns the position of the mouse cursor in scene coordinates at the moment the the context menu was requested. \sa pos(), screenPos()*/QPointF QGraphicsSceneContextMenuEvent::scenePos() const{ Q_D(const QGraphicsSceneContextMenuEvent); return d->scenePos;}/*! \fn void QGraphicsSceneContextMenuEvent::setScenePos(const QPointF &point) \internal Sets the position associated with the context menu to the given \a point in scene coordinates.*/void QGraphicsSceneContextMenuEvent::setScenePos(const QPointF &pos){ Q_D(QGraphicsSceneContextMenuEvent); d->scenePos = pos;}/*! Returns the position of the mouse cursor in screen coordinates at the moment the the context menu was requested. \sa pos(), scenePos()*/QPoint QGraphicsSceneContextMenuEvent::screenPos() const{ Q_D(const QGraphicsSceneContextMenuEvent); return d->screenPos;}/*! \fn void QGraphicsSceneContextMenuEvent::setScreenPos(const QPoint &point) \internal Sets the position associated with the context menu to the given \a point in screen coordinates.*/void QGraphicsSceneContextMenuEvent::setScreenPos(const QPoint &pos){ Q_D(QGraphicsSceneContextMenuEvent); d->screenPos = pos;}/*! Returns the keyboard modifiers in use when the context menu was requested.*/Qt::KeyboardModifiers QGraphicsSceneContextMenuEvent::modifiers() const{ Q_D(const QGraphicsSceneContextMenuEvent); return d->modifiers;}/*! \internal Sets the keyboard modifiers associated with the context menu to the \a modifiers specified.*/void QGraphicsSceneContextMenuEvent::setModifiers(Qt::KeyboardModifiers modifiers){ Q_D(QGraphicsSceneContextMenuEvent); d->modifiers = modifiers;}/*! Returns the reason for the context menu event. \sa QGraphicsSceneContextMenuEvent::Reason*/QGraphicsSceneContextMenuEvent::Reason QGraphicsSceneContextMenuEvent::reason() const{ Q_D(const QGraphicsSceneContextMenuEvent); return d->reason;}/*! \internal Sets the reason for the context menu event to \a reason. \sa reason()*/void QGraphicsSceneContextMenuEvent::setReason(Reason reason){ Q_D(QGraphicsSceneContextMenuEvent); d->reason = reason;}class QGraphicsSceneHoverEventPrivate : public QGraphicsSceneEventPrivate{public: QPointF pos; QPointF scenePos; QPoint screenPos;};/*! \internal Constructs a graphics scene hover event of the specified \a type.*/QGraphicsSceneHoverEvent::QGraphicsSceneHoverEvent(Type type) : QGraphicsSceneEvent(*new QGraphicsSceneHoverEventPrivate, type){}/*! Destroys the event.*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -