ebodien
12 years agoContributor
Read Qt text color in TestComplete
Greetings:
I am trying to read the color of text displayed by a Qt application using TestComplete and I'm not having much luck. I've tried multiple auto complete options for the font, palette and style sheet properties of the label and in most cases I recieve an error.
For example:
I am trying to read the color of text displayed by a Qt application using TestComplete and I'm not having much luck. I've tried multiple auto complete options for the font, palette and style sheet properties of the label and in most cases I recieve an error.
For example:
Set Screen = <NameMapped Label>
Color = Screen.QWidget_palette.QPalette_color
Log.Message("Text color is: " & Color)
Any tips on how to access the color propert of a test string would be appreciated.
Hi Eero,
Try using the following code:
function getColor()
{
var lbl = Sys.Process("TextColor").QtObject("TextColorClass").QtObject("label");
var role = lbl.QWidget_foregroundRole();
var color = lbl.palette.QPalette_color(role);
Log.Message(color.QColor_value());
}