When testing Qt applications, you may come across several typical issues. Here, you can find information on these issues and recommendations on how to fix some of them.
Issues with simulating user actions in Qt 6 applications in High-DPI systems
TestComplete may fail to simulate recorded user actions over a Qt 6 application in High-DPI systems.
Issues with getting access to the application’s objects
For TestComplete to be able to access objects in a tested Qt application, their properties and methods, the following modules of the application must keep their original name. In other words, do not rename the following modules:
Where N is the used Qt version: 5 or 6.
Also, we do not recommend that you modify these files. For example, your tested Qt application developers may delete unused functions from these files to reduce their size. However, TestComplete may use the deleted functions to access the application’s objects. If the required functions are deleted, TestComplete will not be able to recognize some objects in the application.
The context menu items and their subitems may be recognized as siblings.
For example, suppose the tested Qt application has a
QtToolButton control that invokes a context menu upon a click, and each context menu item has a number of subitems. When recording a test with TestComplete you may face the following problem: the context menu items and their subitems will be recognized as siblings, so, clicks over them will be recorded as clicks over items of the same level. This behavior is caused by the following reason: invoked subitems are not child items of the button’s context menu items to which they correspond (their
Parent property returns an empty object). In order for tests to be recorded and played back correctly, the tested application’s developer must associate the context menu items with the appropriate subitems in the application.
A control’s popup menu may be recognized incorrectly.
Due to the specifics of Qt applications, it is impossible to determine which menu is a control’s popup menu. Because of this, TestComplete considers the first child menu of a control as its popup menu. If the control has more than one child menu, TestComplete may recognize the popup menu incorrectly. To avoid this, you can use one of the following solutions:
Make sure the popup menu is the only child menu of the control.
QtObjectmethod to refer to the popup menu. To avoid wrong recognition, you should specify the menu name in the
windowsTitleproperty in your Qt application:
In this case, you can get the popup menu by using code that looks like the following: