QTestEventList Class
The QTestEventList class provides a list of GUI events. More...
Header: | #include <QTestEventList> |
qmake: | QT += testlib |
Inherits: | QList |
Public Functions
QTestEventList() | |
QTestEventList(const QTestEventList &other) | |
~QTestEventList() | |
void | addDelay(int msecs) |
void | addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = ..., int msecs = ...) |
void | addKeyClick(char ascii, Qt::KeyboardModifiers modifiers = ..., int msecs = ...) |
void | addKeyClicks(const QString &keys, Qt::KeyboardModifiers modifiers = ..., int msecs = ...) |
void | addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = ..., int msecs = ...) |
void | addKeyPress(char ascii, Qt::KeyboardModifiers modifiers = ..., int msecs = ...) |
void | addKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = ..., int msecs = ...) |
void | addKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = ..., int msecs = ...) |
void | addMouseClick(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...) |
void | addMouseDClick(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...) |
void | addMouseMove(QPoint pos = ..., int delay = ...) |
void | addMousePress(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...) |
void | addMouseRelease(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...) |
void | clear() |
void | simulate(QWidget *w) |
- 78 public functions inherited from QList
Additional Inherited Members
- 3 static public members inherited from QList
Detailed Description
The QTestEventList class provides a list of GUI events.
A QTestEventList can be populated with GUI events that can be stored as test data for later usage, or be replayed on any QWidget. QTestEventList provides convenience functions for populating the list.
Example:
QTestEventList events; events.addKeyClick('a'); events.addKeyClick(Qt::Key_Backspace); events.addDelay(200); QLineEdit *lineEdit = new QLineEdit(myParent); ... events.simulate(lineEdit); events.simulate(lineEdit);
The example above simulates the user entering the character a
followed by a backspace, waiting for 200 milliseconds and repeating it.
Member Function Documentation
QTestEventList::QTestEventList()
Constructs an empty QTestEventList.
QTestEventList::QTestEventList(const QTestEventList &other)
Constructs a new QTestEventList as a copy of other.
QTestEventList::~QTestEventList()
Empties the list and destroys all stored events.
void QTestEventList::addDelay(int msecs)
Adds a msecs milliseconds delay.
See also QTest::qWait().
void QTestEventList::addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = ..., int msecs = ...)
Adds a new key click to the list. The event will simulate the key qtKey with the modifier modifiers and then wait for msecs milliseconds.
See also QTest::keyClick().
void QTestEventList::addKeyClick(char ascii, Qt::KeyboardModifiers modifiers = ..., int msecs = ...)
This is an overloaded function.
Adds a new key click to the list. The event will simulate the key ascii with the modifier modifiers and then wait for msecs milliseconds.
See also QTest::keyClick().
void QTestEventList::addKeyClicks(const QString &keys, Qt::KeyboardModifiers modifiers = ..., int msecs = ...)
Adds new keyboard entries to the list. The event will press the keys with the modifiers and wait msecs milliseconds between each key.
See also QTest::keyClicks().
void QTestEventList::addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = ..., int msecs = ...)
Adds a new key press to the list. The event will press the key qtKey with the modifier modifiers and then wait for msecs milliseconds.
See also QTest::keyPress().
void QTestEventList::addKeyPress(char ascii, Qt::KeyboardModifiers modifiers = ..., int msecs = ...)
This is an overloaded function.
Adds a new key press to the list. The event will press the key ascii with the modifier modifiers and then wait for msecs milliseconds.
See also QTest::keyPress().
void QTestEventList::addKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = ..., int msecs = ...)
Adds a new key release to the list. The event will release the key qtKey with the modifier modifiers and then wait for msecs milliseconds.
See also QTest::keyRelease().
void QTestEventList::addKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = ..., int msecs = ...)
This is an overloaded function.
Adds a new key release to the list. The event will release the key ascii with the modifier modifiers and then wait for msecs milliseconds.
See also QTest::keyRelease().
void QTestEventList::addMouseClick(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...)
Add a mouse click to the list. The event will click the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.
See also QTest::mouseClick().
void QTestEventList::addMouseDClick(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...)
Add a double mouse click to the list. The event will double click the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.
See also QTest::mousePress().
void QTestEventList::addMouseMove(QPoint pos = ..., int delay = ...)
Adds a mouse move to the list. The event will move the mouse to the position pos. If a delay (in milliseconds) is set, the test will wait after moving the mouse. The default position is the center of the widget.
See also QTest::mousePress().
void QTestEventList::addMousePress(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...)
Add a mouse press to the list. The event will press the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.
See also QTest::mousePress().
void QTestEventList::addMouseRelease(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = ..., QPoint pos = ..., int delay = ...)
Add a mouse release to the list. The event will release the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.
See also QTest::mouseRelease().
void QTestEventList::clear()
Removes all events from the list.
void QTestEventList::simulate(QWidget *w)
Simulates the events from the list one by one on the widget w. For an example, please read the QTestEventList class documentation.
© 2021 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.