SetQtProperty
void SetQtProperty(string control, string property, string value)void SetQtProperty(string control, string property, int value)
void SetQtProperty(string control, string property, bool value)
Description
Sets a Qt widget property by locating the corresponding UIAutomation element in the application, determining its screen coordinates and class type, and forwarding a SET request with the given value to the QtAgent.
Supported value types are string, integer, and boolean. If any lookup, type conversion, or communication step fails, the script is aborted and an error is logged.
Typical use cases
Updating visual Qt widget values (e.g., filling text fields, checking/unchecking checkboxes).
Modifying state or properties not directly exposed by UIAutomation.
Performing automated input or configuration changes in Qt-based applications.
Notes
The function relies on UIAutomation to find the control by name.
The widget’s bounding rectangle center is used as a coordinate reference for the QtAgent.
Only string, int, or bool values are allowed. Other types will abort the script.
On any error (missing control, lookup failure, invalid type, missing rectangle, communication issue, agent error), the method logs the failure and aborts the script.
Parameters
control - Name/identifier of the UI element to modify.
property - Property name to set on the Qt widget.
value - Value to assign to the property. Can be string, int, or bool.
Returns
boolean - true if the property was successfully set. On failure, the script is aborted and the return value is undefined.
Example
void main()
{
// Set string value
SetQtProperty("TXT_USERNAME", "value", "JohnDoe");
// Set integer value
SetQtProperty("SPN_AGE", "value", 42);
// Set boolean value
SetQtProperty("CHK_REMEMBER_ME", "checked", true);
}