Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to generate a fake mouse events?
-
Hi,
i'm trying to generate a artificial (random pos) mouse events, using:
QMouseEvent and QCoreApplication::instance()->postEvent()
without success.
"Any ideas?" :(
-
you can use QTest::mouseMove(), ::mouseClick() etc.
More info:
- "QTest":http://developer.qt.nokia.com/doc/qt-4.7/qtest.html#id-bb25a0c4-7bca-451e-bc26-b0d46c6b6243
- "QTestLib":http://developer.qt.nokia.com/doc/qt-4.7/qtestlib-manual.html#id-5c55b407-8319-459d-b5e8-e88c11cb0897
- "and a convenient tutorial":http://developer.qt.nokia.com/doc/qt-4.7/qtestlib-tutorial1.html
Hope that helps.
-
Tnks,
I'll try it!!!
-
But QtTest is to be used for test automation, not for productive code. IMHO you should not deploy it. From my POV, you should use platform specific code to do it or check, how QtTest does it and do it in the same way.