The QWaylandSeat class provides access to keyboard, mouse, and touch input. 更多...
头: | #include <QWaylandSeat> |
qmake: | QT += waylandcompositor |
Since: | Qt 5.8 |
实例化: | WaylandSeat |
继承: | QWaylandObject |
该类在 Qt 5.8 引入。
enum | CapabilityFlag { Pointer, Keyboard, Touch, DefaultCapabilities } |
flags | CapabilityFlags |
QWaylandSeat (QWaylandCompositor * compositor , QWaylandSeat::CapabilityFlags capabilityFlags = DefaultCapabilities) | |
virtual | ~QWaylandSeat () override |
QWaylandSeat::CapabilityFlags | capabilities () const |
QWaylandCompositor * | compositor () const |
QWaylandDrag * | drag () const |
virtual void | initialize () |
bool | isInitialized () const |
QWaylandKeyboard * | keyboard () const |
QWaylandSurface * | keyboardFocus () const |
QWaylandKeymap * | keymap () |
QWaylandView * | mouseFocus () const |
QWaylandPointer * | pointer () const |
void | sendFullKeyEvent (QKeyEvent * event ) |
void | sendFullTouchEvent (QWaylandSurface * surface , QTouchEvent * event ) |
void | sendKeyEvent (int qtKey , bool pressed ) |
void | sendKeyPressEvent (uint code ) |
void | sendKeyReleaseEvent (uint code ) |
void | sendMouseMoveEvent (QWaylandView * view , const QPointF & localPos , const QPointF & outputSpacePos = QPointF()) |
void | sendMousePressEvent (Qt::MouseButton button ) |
void | sendMouseReleaseEvent (Qt::MouseButton button ) |
void | sendMouseWheelEvent (Qt::Orientation orientation , int delta ) |
void | sendTouchCancelEvent (QWaylandClient * client ) |
void | sendTouchFrameEvent (QWaylandClient * client ) |
uint | sendTouchPointEvent (QWaylandSurface * surface , int id , const QPointF & point , Qt::TouchPointState state ) |
uint | sendTouchPointMoved (QWaylandSurface * surface , int id , const QPointF & position ) |
uint | sendTouchPointPressed (QWaylandSurface * surface , int id , const QPointF & position ) |
uint | sendTouchPointReleased (QWaylandSurface * surface , int id , const QPointF & position ) |
bool | setKeyboardFocus (QWaylandSurface * surface ) |
void | setMouseFocus (QWaylandView * view ) |
QWaylandTouch * | touch () const |
void | cursorSurfaceRequest (QWaylandSurface * surface , int hotspotX , int hotspotY ) |
void | keyboardFocusChanged (QWaylandSurface * newFocus , QWaylandSurface * oldFocus ) |
void | mouseFocusChanged (QWaylandView * newFocus , QWaylandView * oldFocus ) |
QWaylandSeat * | fromSeatResource (struct ::wl_resource * resource ) |
The QWaylandSeat provides access to different types of user input and maintains a keyboard focus and a mouse pointer. It corresponds to the wl_seat interface in the Wayland protocol.
This enum type describes the capabilities of a QWaylandSeat .
常量 | 值 | 描述 |
---|---|---|
QWaylandSeat::Pointer
|
0x01
|
The QWaylandSeat supports pointer input. |
QWaylandSeat::Keyboard
|
0x02
|
The QWaylandSeat supports keyboard input. |
QWaylandSeat::Touch
|
0x04
|
The QWaylandSeat supports touch input. |
QWaylandSeat::DefaultCapabilities
|
Pointer | Keyboard | Touch
|
The QWaylandSeat has the default capabilities. |
The CapabilityFlags type is a typedef for QFlags <CapabilityFlag>. It stores an OR combination of CapabilityFlag values.
This property holds the drag and drop operations and sends signals when they start and end. The property stores details like what image should be under the mouse cursor when the user drags it.
访问函数:
QWaylandDrag * | drag () const |
This property holds the keymap object.
A keymap provides a way to translate actual key scan codes into a meaningful value. For example, if you use a keymap with a Norwegian layout, the key to the right of the letter L produces an Ø.
Keymaps can also be used to customize key functions, such as to specify whether Control and CAPS lock should be swapped, and so on.
访问函数:
QWaylandKeymap * | keymap () |
Constructs a QWaylandSeat for the given compositor and capabilityFlags .
[signal]
void
QWaylandSeat::
cursorSurfaceRequest
(
QWaylandSurface
*
surface
,
int
hotspotX
,
int
hotspotY
)
This signal is emitted when the client has requested for a specific surface to be the mouse cursor. For example, when the user hovers over a particular surface, and you want the cursor to change into a resize arrow.
Both hotspotX and hotspotY are offsets from the top-left of a pointer surface, where a click should happen. For example, if the requested cursor surface is an arrow, the parameters indicate where the arrow's tip is, on that surface.
[signal]
void
QWaylandSeat::
keyboardFocusChanged
(
QWaylandSurface
*
newFocus
,
QWaylandSurface
*
oldFocus
)
此信号发射当 setKeyboardFocus () 被调用。
newFocus
has the surface that received keyboard focus; or
nullptr
if no surface has focus.
oldFocus
has the surface that lost keyboard focus; or
nullptr
if no surface had focus.
[signal]
void
QWaylandSeat::
mouseFocusChanged
(
QWaylandView
*
newFocus
,
QWaylandView
*
oldFocus
)
This signal is emitted when the mouse focus has changed from oldFocus to newFocus .
[override virtual]
QWaylandSeat::
~QWaylandSeat
()
销毁 QWaylandSeat
Returns the capability flags for this QWaylandSeat .
Returns the compositor for this QWaylandSeat .
Returns the drag object for this QWaylandSeat .
注意: Getter function for property drag.
[static]
QWaylandSeat
*QWaylandSeat::
fromSeatResource
(
struct
::wl_resource
*
resource
)
返回 QWaylandSeat corresponding to the resource 。 resource is expected to have the type wl_seat.
[虚拟]
void
QWaylandSeat::
initialize
()
Initializes parts of the seat corresponding to the capabilities set in the constructor, or through setCapabilities().
注意: Normally, this function is called automatically after the seat and compositor have been created, so calling it manually is usually unnecessary.
返回 true 若 QWaylandSeat is initialized; false otherwise.
值
true
indicates that it's now possible for clients to start using the seat.
Returns the keyboard for this input device.
Returns the current focused surface for keyboard input.
另请参阅 setKeyboardFocus ().
Returns the keymap object for this QWaylandSeat .
注意: Getter function for property keymap.
Returns the view that currently has mouse focus.
另请参阅 setMouseFocus ().
Returns the pointer device for this QWaylandSeat .
发送 event to the keyboard device.
发送 event 到指定 surface on the touch device.
警告: This API will automatically map QTouchEvent::TouchPoint::id to a sequential id before sending it to the client. It should therefore not be used in combination with the other API using explicit ids, as collisions might occur.
Sends a key press (if
pressed
is
true
) or release (if
pressed
is
false
) event of a key
qtKey
to the keyboard device.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
该函数在 Qt 5.12 引入。
Sends a key press event with the key code to the keyboard device.
Sends a key release event with the key code to the keyboard device.
Sets the mouse focus to view and sends a mouse move event to the pointer device with the local position localPos and output space position outputSpacePos .
Sends a mouse press event for button 到 QWaylandSeat 's pointer device.
Sends a mouse release event for button 到 QWaylandSeat 's pointer device.
Sends a mouse wheel event to the QWaylandSeat 's pointer device with the given orientation and delta .
Sends a cancel event to the touch device of a client .
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Sends a frame event to the touch device of a client to indicate the end of a series of touch up, down, and motion events.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Sends a touch point event to the surface on a touch device with the given id , point and state .
警告: This API should not be used in combination with forwarding of touch events using QWaylandQuickItem::touchEventsEnabled or sendFullTouchEvent , as it might lead to conflicting touch ids.
Returns the serial for the touch up or touch down event.
Sends a touch moved event for the touch point id on surface with position position .
注意: You need to send a touch frame event when you are done sending touch events.
警告: This API should not be used in combination with forwarding of touch events using QWaylandQuickItem::touchEventsEnabled or sendFullTouchEvent , as it might lead to conflicting touch ids.
Returns the serial for the touch motion event.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Sends a touch pressed event for the touch point id on surface with position position .
注意: You need to send a touch frame event when you are done sending touch events.
警告: This API should not be used in combination with forwarding of touch events using QWaylandQuickItem::touchEventsEnabled or sendFullTouchEvent , as it might lead to conflicting touch ids.
Returns the serial for the touch down event.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Sends a touch released event for the touch point id on surface with position position .
注意: You need to send a touch frame event when you are done sending touch events.
警告: This API should not be used in combination with forwarding of touch events using QWaylandQuickItem::touchEventsEnabled or sendFullTouchEvent , as it might lead to conflicting touch ids.
Returns the serial for the touch up event.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Sets the current keyboard focus to surface . Returns a boolean indicating if the operation was successful.
另请参阅 keyboardFocus ().
Sets the current mouse focus to view .
另请参阅 mouseFocus ().
Returns the touch device for this QWaylandSeat .