Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QTestEventList Class

TheQTestEventList class provides a list of GUI events.More...

Header:#include <QTestEventList>
Inherits:QList<QTestEvent *>

Public Functions

QTestEventList()
QTestEventList(const QTestEventList & other)
~QTestEventList()
voidaddDelay(int msecs)
voidaddKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
voidaddKeyClick(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
voidaddKeyClicks(const QString & keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
voidaddKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
voidaddKeyPress(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
voidaddKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
voidaddKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
voidaddMouseClick(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1)
voidaddMouseDClick(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1)
voidaddMouseMove(QPoint pos = QPoint(), int delay = -1)
voidaddMousePress(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1)
voidaddMouseRelease(Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1)
voidclear()
voidsimulate(QWidget * w)
  • 68 public functions inherited fromQList

Additional Inherited Members

  • 3 static public members inherited fromQList

Detailed Description

TheQTestEventList class provides a list of GUI events.

QTestEventList inherits fromQList<QTestEvent *>, and provides convenience functions for populating the list.

AQTestEventList can be populated with GUI events that can be stored as test data for later usage, or be replayed on anyQWidget.

Example:

QTestEventList events;events.addKeyClick('a');events.addKeyClick(Qt::Key_Backspace);events.addDelay(200);QLineEdit*lineEdit=newQLineEdit(myParent);...events.simulate(lineEdit);events.simulate(lineEdit);

The example above simulates the user entering the charactera followed by a backspace, waiting for 200 milliseconds and repeating it.

Member Function Documentation

QTestEventList::QTestEventList()

Constructs an emptyQTestEventList.

QTestEventList::QTestEventList(constQTestEventList & other)

Constructs a newQTestEventList as a copy ofother.

QTestEventList::~QTestEventList()

Empties the list and destroys all stored events.

void QTestEventList::addDelay(int msecs)

Adds amsecs milliseconds delay.

See alsoQTest::qWait().

void QTestEventList::addKeyClick(Qt::Key qtKey,Qt::KeyboardModifiers modifiers = Qt::NoModifier,int msecs = -1)

Adds a new key click to the list. The event will simulate the keyqtKey with the modifiermodifiers and then wait formsecs milliseconds.

See alsoQTest::keyClick().

void QTestEventList::addKeyClick(char ascii,Qt::KeyboardModifiers modifiers = Qt::NoModifier,int msecs = -1)

This is an overloaded function.

Adds a new key click to the list. The event will simulate the keyascii with the modifiermodifiers and then wait formsecs milliseconds.

See alsoQTest::keyClick().

void QTestEventList::addKeyClicks(constQString & keys,Qt::KeyboardModifiers modifiers = Qt::NoModifier,int msecs = -1)

Adds new keyboard entries to the list. The event will press thekeys with themodifiers and waitmsecs milliseconds between each key.

See alsoQTest::keyClicks().

void QTestEventList::addKeyPress(Qt::Key qtKey,Qt::KeyboardModifiers modifiers = Qt::NoModifier,int msecs = -1)

Adds a new key press to the list. The event will press the keyqtKey with the modifiermodifiers and then wait formsecs milliseconds.

See alsoQTest::keyPress().

void QTestEventList::addKeyPress(char ascii,Qt::KeyboardModifiers modifiers = Qt::NoModifier,int msecs = -1)

This is an overloaded function.

Adds a new key press to the list. The event will press the keyascii with the modifiermodifiers and then wait formsecs milliseconds.

See alsoQTest::keyPress().

void QTestEventList::addKeyRelease(Qt::Key qtKey,Qt::KeyboardModifiers modifiers = Qt::NoModifier,int msecs = -1)

Adds a new key release to the list. The event will release the keyqtKey with the modifiermodifiers and then wait formsecs milliseconds.

See alsoQTest::keyRelease().

void QTestEventList::addKeyRelease(char ascii,Qt::KeyboardModifiers modifiers = Qt::NoModifier,int msecs = -1)

This is an overloaded function.

Adds a new key release to the list. The event will release the keyascii with the modifiermodifiers and then wait formsecs milliseconds.

See alsoQTest::keyRelease().

void QTestEventList::addMouseClick(Qt::MouseButton button,Qt::KeyboardModifiers modifiers = 0,QPoint pos = QPoint(),int delay = -1)

Add a mouse click to the list. The event will click thebutton with optionalmodifiers at the positionpos with an optionaldelay. The default position is the center of the widget.

See alsoQTest::mouseClick().

void QTestEventList::addMouseDClick(Qt::MouseButton button,Qt::KeyboardModifiers modifiers = 0,QPoint pos = QPoint(),int delay = -1)

Add a double mouse click to the list. The event will double click thebutton with optionalmodifiers at the positionpos with an optionaldelay. The default position is the center of the widget.

See alsoQTest::mousePress().

void QTestEventList::addMouseMove(QPoint pos = QPoint(),int delay = -1)

Adds a mouse move to the list. The event will move the mouse to the positionpos. If adelay (in milliseconds) is set, the test will wait after moving the mouse. The default position is the center of the widget.

See alsoQTest::mousePress().

void QTestEventList::addMousePress(Qt::MouseButton button,Qt::KeyboardModifiers modifiers = 0,QPoint pos = QPoint(),int delay = -1)

Add a mouse press to the list. The event will press thebutton with optionalmodifiers at the positionpos with an optionaldelay. The default position is the center of the widget.

See alsoQTest::mousePress().

void QTestEventList::addMouseRelease(Qt::MouseButton button,Qt::KeyboardModifiers modifiers = 0,QPoint pos = QPoint(),int delay = -1)

Add a mouse release to the list. The event will release thebutton with optionalmodifiers at the positionpos with an optionaldelay. The default position is the center of the widget.

See alsoQTest::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 widgetw. For an example, please read theQTestEventList class documentation.

© 2016 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 theGNU 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.


[8]ページ先頭

©2009-2025 Movatter.jp