InputScriptInterface Class
The InputScriptInterface class enables you to emulate user input with a mouse or the keyboard. More...
Header: | #include <InputScriptInterface> |
Public Types
enum | MouseButton { NoButton, LeftButton, RightButton, MiddleButton, ..., MouseButtonMask } |
flags | MouseButtons |
Properties
- ignoreDeviceRotation : bool
Public Functions
void | click(qint32 x, qint32 y) |
void | doubleClick(qint32 x, qint32 y) |
bool | ignoreDeviceRotation() const |
void | keyPress(QChar c) |
void | keyRelease(QChar c) |
void | mouseMove(qint32 x, qint32 y) |
QPoint | mousePosition() const |
void | mousePress(InputScriptInterface::MouseButton button, qint32 x, qint32 y) |
void | mouseRelease(InputScriptInterface::MouseButton button, qint32 x, qint32 y) |
int | mouseX() const |
int | mouseY() const |
void | rightClick(qint32 x, qint32 y) |
void | setScreen(const QString &screenName) |
void | type(const QString &string) |
Public Slots
void | setIgnoreDeviceRotation(bool map) |
Static Public Members
const QMetaObject | staticMetaObject |
Detailed Description
The InputScriptInterface class enables you to emulate user input with a mouse or the keyboard.
The InputScriptInterface class is exposed as input
.
Member Type Documentation
enum InputScriptInterface::MouseButton
flags InputScriptInterface::MouseButtons
This enum type describes the mouse buttons:
Constant | Value | Description |
---|---|---|
InputScriptInterface::NoButton | 0x00000000 | The button state does not refer to any button. |
InputScriptInterface::LeftButton | 0x00000001 | The left button is pressed, or an event refers to the left button. The left button may be the right button on a left-handed mouse. |
InputScriptInterface::RightButton | 0x00000002 | The right button. |
InputScriptInterface::MiddleButton | MidButton | The middle button. |
InputScriptInterface::XButton1 | 0x00000008 | The Back button. |
InputScriptInterface::XButton2 | 0x00000010 | The Forward button. |
InputScriptInterface::MouseButtonMask | 0x000000ff | This value corresponds to a mask of possible mouse buttons. Use it to specify that a mouse area accepts several mouse buttons. |
The MouseButtons type is a typedef for QFlags<MouseButton>. It stores an OR combination of MouseButton values.
Property Documentation
ignoreDeviceRotation : bool
This property holds whether to ignore device orientation when creating mouse events or reading mouse position.
This property handles the way mouse coordinates are mapped to the device. When it is set to false
, the top left corner (0, 0) corresponds to the top left corner in relation to the current device orientation.
When it is set to true
, the top left corner always is the top left corner of the display no matter which orientation is set at the moment.
Access functions:
bool | ignoreDeviceRotation() const |
void | setIgnoreDeviceRotation(bool map) |
Member Function Documentation
void InputScriptInterface::click(qint32 x, qint32 y)
Creates a mouse click event by pressing down and releasing a mouse button at the position specified by x and y.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::doubleClick(qint32 x, qint32 y)
Creates a double-click event by pressing down and releasing a mouse button twice at the position specified by x and y.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::keyPress(QChar c)
Creates a key press event by using the key specified by c.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::keyRelease(QChar c)
Releases the key specified by c.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::mouseMove(qint32 x, qint32 y)
Moves the mouse to the position specified by x and y.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
QPoint InputScriptInterface::mousePosition() const
Reads the x and y coordinates of the mouse position.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also InputScriptInterface::ignoreDeviceRotation.
void InputScriptInterface::mousePress(InputScriptInterface::MouseButton button, qint32 x, qint32 y)
Presses down and holds the mouse button button at the position specified by x and y.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::mouseRelease(InputScriptInterface::MouseButton button, qint32 x, qint32 y)
Releases the mouse button button at the position specified by x and y.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
int InputScriptInterface::mouseX() const
Returns the x coordinate of the mouse position.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
int InputScriptInterface::mouseY() const
Returns the y coordinate of the mouse position.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::rightClick(qint32 x, qint32 y)
Creates a right button click event at the position specified by x and y.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::setScreen(const QString &screenName)
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void InputScriptInterface::type(const QString &string)
Emulates typing the string string on the keyboard.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Member Variable Documentation
Related Non-Members
Macro Documentation
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.