📄 qevent.cpp
字号:
\fn int QInputMethodEvent::replacementLength() const Returns the number of characters to be replaced in the preedit string. \sa replacementStart(), setCommitString()*/#ifndef QT_NO_TABLETEVENT/*! \class QTabletEvent \brief The QTabletEvent class contains parameters that describe a Tablet event. \ingroup events Tablet Events are generated from a Wacom tablet. Most of the time you will want to deal with events from the tablet as if they were events from a mouse; for example, you would retrieve the cursor position with x(), y(), pos(), globalX(), globalY(), and globalPos(). In some situations you may wish to retrieve the extra information provided by the tablet device driver; for example, you might want to do subpixeling with higher resolution coordinates or you may want to adjust color brightness based on pressure. QTabletEvent allows you to read the pressure(), the xTilt(), and yTilt(), as well as the type of device being used with device() (see \l{TabletDevice}). It can also give you the minimum and maximum values for each device's pressure and high resolution coordinates. A tablet event contains a special accept flag that indicates whether the receiver wants the event. You should call QTabletEvent::accept() if you handle the tablet event; otherwise it will be sent to the parent widget. The exception are TabletEnterProximity and TabletLeaveProximity events, these are only sent to QApplication and don't check whether or not they are accepted. The QWidget::setEnabled() function can be used to enable or disable mouse and keyboard events for a widget. The event handler QWidget::tabletEvent() receives all three types of tablet events. Qt will first send a tabletEvent then, if it is not accepted, it will send a mouse event. This allows applications that don't utilize tablets to use a tablet like a mouse, while also enabling those who want to use both tablets and mouses differently. \section1 Notes for X11 Users Qt uses the following hard-coded names to identify tablet devices from the xorg.conf file on X11 (apart from IRIX): 'stylus', 'pen', and 'eraser'. If the devices have other names, they will not be picked up Qt.*//*! \enum QTabletEvent::TabletDevice This enum defines what type of device is generating the event. \value NoDevice No device, or an unknown device. \value Puck A Puck (a device that is similar to a flat mouse with a transparent circle with cross-hairs). \value Stylus A Stylus. \value Airbrush An airbrush \value FourDMouse A 4D Mouse. \value RotationStylus A special stylus that also knows about rotation (a 6D stylus). \since 4.1 \omitvalue XFreeEraser*//*! \enum QTabletEvent::PointerType This enum defines what type of point is generating the event. \value UnknownPointer An unknown device. \value Pen Tip end of a stylus-like device (the narrow end of the pen). \value Cursor Any puck-like device. \value Eraser Eraser end of a stylus-like device (the broad end of the pen). \sa pointerType()*//*! Construct a tablet event of the given \a type. The \a pos parameter indicates where the event occurred in the widget; \a globalPos is the corresponding position in absolute coordinates. The \a hiResGlobalPos contains a high resolution measurement of the position. \a pressure contains the pressure exerted on the \a device. \a pointerType describes the type of pen that is being used. \a xTilt and \a yTilt contain the device's degree of tilt from the x and y axes respectively. \a keyState specifies which keyboard modifiers are pressed (e.g., \key{Ctrl}). The \a uniqueID parameter contains the unique ID for the current device. The \a z parameter contains the coordinate of the device on the tablet, this is usually given by a wheel on 4D mouse. If the device does not support a Z-axis, pass zero here. The \a tangentialPressure paramater contins the tangential pressure of an air brush. If the device does not support tangential pressure, pass 0 here. \a rotation contains the device's rotation in degrees. 4D mice support rotation. If the device does not support rotation, pass 0 here. \sa pos() globalPos() device() pressure() xTilt() yTilt() uniqueId(), rotation(), tangentialPressure(), z()*/QTabletEvent::QTabletEvent(Type type, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID) : QInputEvent(type, keyState), mPos(pos), mGPos(globalPos), mHiResGlobalPos(hiResGlobalPos), mDev(device), mPointerType(pointerType), mXT(xTilt), mYT(yTilt), mZ(z), mPress(pressure), mTangential(tangentialPressure), mRot(rotation), mUnique(uniqueID), mExtra(0){}/*! \internal*/QTabletEvent::~QTabletEvent(){}/*! \fn TabletDevices QTabletEvent::device() const Returns the type of device that generated the event. \sa TabletDevice*//*! \fn PointerType QTabletEvent::pointerType() const Returns the type of point that generated the event.*//*! \fn qreal QTabletEvent::tangentialPressure() const Returns the tangential pressure for the device. This is typically given by a finger wheel on an airbrush tool. The range is from -1.0 to 1.0. 0.0 indicates a neutral position. Current airbrushes can only move in the positive direction from the neutrual position. If the device does not support tangential pressure, this value is always 0.0. \sa pressure()*//*! \fn qreal QTabletEvent::rotation() const Returns the rotation of the current device in degress. This is usually given by a 4D Mouse. If the device doesn't support rotation this value is always 0.0.*//*! \fn qreal QTabletEvent::pressure() const Returns the pressure for the device. 0.0 indicates that the stylus is not on the tablet, 1.0 indicates the maximum amount of pressure for the stylus. \sa tangentialPressure()*//*! \fn int QTabletEvent::xTilt() const Returns the angle between the device (a pen, for example) and the perpendicular in the direction of the x axis. Positive values are towards the tablet's physical right. The angle is in the range -60 to +60 degrees. \img qtabletevent-tilt.png \sa yTilt()*//*! \fn int QTabletEvent::yTilt() const Returns the angle between the device (a pen, for example) and the perpendicular in the direction of the y axis. Positive values are towards the bottom of the tablet. The angle is within the range -60 to +60 degrees. \sa xTilt()*//*! \fn const QPoint &QTabletEvent::pos() const Returns the position of the device, relative to the widget that received the event. If you move widgets around in response to mouse events, use globalPos() instead of this function. \sa x() y() globalPos()*//*! \fn int QTabletEvent::x() const Returns the x position of the device, relative to the widget that received the event. \sa y() pos()*//*! \fn int QTabletEvent::y() const Returns the y position of the device, relative to the widget that received the event. \sa x() pos()*//*! \fn int QTabletEvent::z() const Returns the z position of the device. Typically this is represented by a wheel on a 4D Mouse. If the device does not support a Z-axis, this value is always zero. This is \bold not the same as pressure. \sa pressure()*//*! \fn const QPoint &QTabletEvent::globalPos() const Returns the global position of the device \e{at the time of the event}. This is important on asynchronous windows systems like X11; whenever you move your widgets around in response to mouse events, globalPos() can differ significantly from the current position QCursor::pos(). \sa globalX() globalY() hiResGlobalPos()*//*! \fn int QTabletEvent::globalX() const Returns the global x position of the mouse pointer at the time of the event. \sa globalY() globalPos() hiResGlobalX()*//*! \fn int QTabletEvent::globalY() const Returns the global y position of the tablet device at the time of the event. \sa globalX() globalPos() hiResGlobalY()*//*! \fn qint64 QTabletEvent::uniqueId() const Returns a unique ID for the current device, making it possible to differentiate between multiple devices being used at the same time on the tablet. Support of this feature is dependent on the tablet. Values for the same device may vary from OS to OS. Later versions of the Wacom driver for Linux will now report the ID information. If you have a tablet that supports unique ID and are not getting the information on Linux, consider upgrading your driver. As of Qt 4.2, the unique ID is the same regardless of the orientation of the pen. Earlier versions would report a different value when using the eraser-end versus the pen-end of the stylus on some OS's. \sa pointerType()*//*! \fn const QPointF &QTabletEvent::hiResGlobalPos() const The high precision coordinates delivered from the tablet expressed. Sub pixeling information is in the fractional part of the QPointF. \sa globalPos() hiResGlobalX() hiResGlobalY()*//*! \fn qreal &QTabletEvent::hiResGlobalX() const The high precision x position of the tablet device.*//*! \fn qreal &QTabletEvent::hiResGlobalY() const The high precision y position of the tablet device.*/#endif // QT_NO_TABLETEVENT#ifndef QT_NO_DRAGANDDROP/*! Creates a QDragMoveEvent of the required \a type indicating that the mouse is at position \a pos given within a widget. The mouse and keyboard states are specified by \a buttons and \a modifiers, and the \a actions describe the types of drag and drop operation that are possible. The drag data is passed as MIME-encoded information in \a data. \warning Do not attempt to create a QDragMoveEvent yourself. These objects rely on Qt's internal state.*/QDragMoveEvent::QDragMoveEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type) : QDropEvent(pos, actions, data, buttons, modifiers, type) , rect(pos, QSize(1, 1)){}/*! Destroys the event.*/QDragMoveEvent::~QDragMoveEvent(){}/*! \fn void QDragMoveEvent::accept(bool y) Calls setAccepted(\a y) instead.*//*! \fn void QDragMoveEvent::accept(const QRect &rectangle) The same as accept(), but also notifies that future moves will also be acceptable if they remain within the \a rectangle given on the widget. This can improve performance, but may also be ignored by the underlying system. If the rectangle is empty, drag move events will be sent continuously. This is useful if the source is scrolling in a timer event.*//*! \fn void QDragMoveEvent::accept() \overload Calls QDropEvent::accept().*//*! \fn void QDragMoveEvent::ignore() \overload Calls QDropEvent::ignore().*//*! \fn void QDragMoveEvent::ignore(const QRect &rectangle) The opposite of the accept(const QRect&) function. Moves within the \a rectangle are not acceptable, and will be ignored.*//*! \fn QRect QDragMoveEvent::answerRect() const Returns the rectangle in the widget where the drop will occur if accepted. You can use this information to restrict drops to certain places on the widget.*//*! \class QDropEvent \ingroup events \ingroup draganddrop \brief The QDropEvent class provides an event which is sent when a drag and drop action is completed. When a widget \l{QWidget::setAcceptDrops()}{accepts drop events}, it will receive this event if it has accepted the most recent QDragEnterEvent or QDragMoveEvent sent to it. The drop event contains a proposed action, available from proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call the acceptProposedAction() function. Since the proposed action can be a combination of \l Qt::DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action. If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the \l{possibleActions()}{possible drop actions} by calling setDropAction() with your preferred action. If y
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -