I use this code:

QTest::mouseMove(this,mapToGlobal(QPoint(x,y)));
QTest::mouseClick(this, Qt::LeftButton,0, mapToGlobal(QPoint(x,y)),-1);

"this" is mainwindow. my code shoud be independent of name of widgets like pushbutton.