PDA

View Full Version : I use QTest/QTestEventList to simulate mouse events, but only succeed in mouseMoving



casual0402
15th March 2010, 07:19
Hi, everyone
I use QTest/QTestEventList to simulate mouse events, but only succeed in mouseMoving.
mouseClick has not effect...:confused:

zgulser
15th March 2010, 08:17
Hi,

Did you reimplement the mouse move, press and release event in your widget class?

casual0402
15th March 2010, 13:36
Hi, thanks first.
I don't reimplement the mouse events, and I don't know how.
Now I know Qt does process mouseClick, but maybe it just sends the event to the specified widget instead of really clicking at the position given.
Now I'm confused about how to make it click....thanks again.

casual0402
15th March 2010, 13:40
To give a statement in detail, I use QTestEventList to addMouseMove, addMouseClick and addKeyClick(Qt::Key_Tab).
When run the program, mouse moved and focus passed to the next unit, but I really can not find mouseClick...

casual0402
15th March 2010, 15:49
Hi, code below


eventList.addDelay(2000);
eventList.addMouseMove(pos);
eventList.addDelay(2000);
eventList.addMouseClick(Qt::LeftButton);
eventList.addDelay(2000);
eventList.addKeyClick(Qt::Key_Tab);
eventList.addDelay(2000);
eventList.addMouseClick(Qt::LeftButton);
eventList.addDelay(2000);
eventList.addKeyClick(Qt::Key_Tab);
eventList.addDelay(2000);
eventList.addMouseClick(Qt::RightButton);
eventList.addDelay(2000);
eventList.addKeyClick(Qt::Key_Tab);
eventList.addDelay(2000);
eventList.addKeyClick(Qt::Key_A);
eventList.addDelay(2000);
eventList.addKeyClick(Qt::Key_0);
eventList.simulate(this);