QT Automation FAQ
Q: Unable to recognize the correct Qt control type, all controls are spied as Custom
A: When spying Qt 4.x applications control, in some situation Model Manager cannot recognize the control type, and all of them are displayed as Custom
type. This is due to the lack of accessible Qt plugins. The the solutions can be found in HOWTO: Identify Control Types for Qt Applications.
Q: Why is the call to the Collapse and Expand methods of the Tree control unsuccessful?
A: The Windows Automation library is designed for standard controls and can support almost all QT controls, but the QT Tree control is not a standard Windows control, so not all methods support it. The Collapse and Expand methods on the TreeItem control are not supported on the QT Tree and will display the error "1003: CannotPerformThisOperation". You can expand or collapse by calling the dblClick
method of the TreeItem control.
Q: The select
method of QT's ComboBox object doesn't work?
A: QT's ComboBox is not a standard Windows control and not all methods are supported. In order to perform select
action, you need to call combination of actions, here are the steps:
In the model manager, you need to add two related objects:
- ComboBox control,
- One of the ComboBox expanded options, namely the ListItem control.
In code:
- Call the
open
method of ComboBox to expand the drop-down box. - Call getListItem to get the needed ListItem. Here in the second parameter, override the
name
property in the model object with the name value you want to select, and dynamically get ListItem element.
- Call the
The sample code is as follows:
await model.getComboBox("<ComboBoxName>").open();
await model.getListItem("<ListItemNameInModel>", {name: '<list item name>'}).click();
Q: The "select" method of the QT Tab control cannot select those tabs that are not yet displayed.
A: It's true that the tab that has not scrolled into the display area cannot be selected automatically. You need to click the left and right arrow buttons on the side of the tab to move the tab to the display area and then click.
Q: There are limited identifying properties in the QT control. "index" property need to be added in order to uniquely identify the control. Are there any alternative ways?
A: The model manager can automatically add indexes:
After selecting a control, "Add Object" window appears, click the "Verify Uniqueness". If this is not unique, a message window similiar to the following appears.
Objects that cannot be uniquely identified are displayed in red.
Now when choose to add the object to the model, a dialog box appears, asking if you need to add "index":
At this time, selecting "Yes" will add necessary index when adding these objects to the model:
Note: Remember to first verify the uniqueness and then added to the model to have the indexes added.
Q: how to set the value for Date Edit control in QT?
A: You can double-click the front of the control by dblClick
first, then pressKeys
to enter the date content.
Q: How to access Rows, Columns and Cell of Table in QT application.
A: Refer to HOWTO: QT Table Control Automation for more information.