GetQtProperty
string GetQtProperty(string control, string property)int GetQtProperty(string control, string property)
bool GetQtProperty(string control, string property)
Description
Retrieves a Qt widget property by locating the corresponding UIAutomation element in the application, determining its screen coordinates and class type.
In addition to native Qt properties and parameterless methods, this function supports extended, widget-specific query functions for complex Qt widgets such as QTableWidget and QTreeWidget.
If any lookup, parsing, or communication step fails, the script is aborted and an error is logged.
Typical use cases
Reading the value of visual Qt widgets (e.g., text fields, checkboxes, labels).
Fetching state information not directly exposed by UIAutomation.
Accessing Qt-specific properties required for validations.
Querying structured content of complex widgets (tables, trees).
Parameters
control – Name/identifier of the UI element to search for.
property – Property name or extended widget function to retrieve from the Qt widget.
Returns
string – The retrieved property value.
Boolean values are returned as "true" or "false".
On failure the script is aborted and the return value is undefined.
Supported extended widget functions
QTableWidget-specific functions
cellText(row, column)
Returns the text content of the specified table cell.
isSelected(row, column)
Returns whether the specified table cell is currently selected.
editCell(row, column, "text")
Simulates user editing of a table cell by opening the cell editor, setting the text, and committing the change.
Returns "true" on success.
Notes
Row and column indices are zero-based.
If a cell exists but contains no item, an empty string is returned.
Examples
string value = GetQtProperty(
"QTABLEWIDGET_MAIN",
"cellText(0,1)"
);
bool selected = GetQtProperty(
"QTABLEWIDGET_MAIN",
"isSelected(0,1)"
);
SetQtProperty(
"QTABLEWIDGET_MAIN",
"editCell(0,1,\"Edited Value\")"
);
QTreeWidget-specific functions
treeText(path, column)
Returns the text of the tree item at the specified path and column.
The path is expressed as a slash-separated index list (e.g.
0/2/1).childCount(path)
Returns the number of child items for the specified tree item.
isExpanded(path)
Returns whether the specified tree item is currently expanded in the view.
Notes
Path indices are zero-based.
The expand/collapse state reflects the current view state of the QTreeWidget.
Examples
string suiteName = GetQtProperty(
"QTREEWIDGET_RESULTS",
"treeText(0,0)"
);
string testResult = GetQtProperty(
"QTREEWIDGET_RESULTS",
"treeText(0/1,1)"
);
string count = GetQtProperty(
"QTREEWIDGET_RESULTS",
"childCount(0)"
);
bool expanded = GetQtProperty(
"QTREEWIDGET_RESULTS",
"isExpanded(0)"
);
Header access (QTableWidget / QTreeWidget)
headerText(column)
Returns the text of the horizontal header at the specified column index.
Supported for both QTableWidget and QTreeWidget.
headerText(vertical, row)
Returns the text of the vertical header at the specified row index.
Supported for QTableWidget only.
Notes
- Header indices are zero-based.
- QTreeWidget supports horizontal headers only.
- If the header exists but has no text assigned, an empty string is returned.
Examples
string colHeader = GetQtProperty(
"QTABLEWIDGET_MAIN",
"headerText(0)"
);
string treeHeader = GetQtProperty(
"QTREEWIDGET_RESULTS",
"headerText(1)"
);
string rowHeader = GetQtProperty(
"QTABLEWIDGET_MAIN",
"headerText(vertical,2)"
);
Generic example
void main()
{
string text = GetQtProperty("TXT_USERNAME", "text");
Print("Username field contains: " + text);
}
Summary
GetQtProperty supports native Qt properties, parameterless Qt methods, and extended widget-specific query functions.
Complex widgets such as tables and trees are accessed via explicit, semantic APIs rather than expression parsing.
All failures are treated as fatal and abort the script to ensure deterministic and reliable test execution.