Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use QTest::mouseClick with QAction

I'm very new to Qt, and I need to simulate a click using the QTest Namespace and QTest::mouseClick. My problem is I would like to click a QMenu entry, defined as a QAction, but the mouseClick function doesn't allow me to pass this as an argument (only QWidgets or QWindows).

What could I do here?

like image 459
Fran M. Avatar asked Oct 18 '22 00:10

Fran M.


1 Answers

You may use another way such direct triggers of your QAction's as far as you have them:

qAction->trigger();

This should have the same impact as mouse clicks in testing purposes.

like image 108
demonplus Avatar answered Dec 28 '22 13:12

demonplus