Also answered in Best approach to QT UI testing
You can use OpenHMITester (OHT), that is an open-source GUI Testing tool following an open architecture that describes a non intrusive capture/replay tool based on GUI Events. It was implemented to be used in Qt; however, it may be adapted to support different windowing systems and operating systems used in the testing environment. (Download) (Further info)