Page 1 of 1

Control Properties change in Qt Application

Posted: Wed May 11, 2011 7:21 pm
by jdres
Operating Systems: Windows 7 Starter (test machines), Windows XP-Service Pack 3 (my local machine)
Ranorex Version: 1.4
Qt version: 4.7.0

We need to extract the value of a label in a Qt application. To do so, we've been finding the control to obtain the element name of the label since the element name is the value that needs to extracted.

The problem is when the dialog is closed and re-opened, the caption/text disappears and it never re-appears. It only re-appears when the entire application is closed and re-started. The class's number also changes.


In this dialog, we are trying to obtain the "ft" value:
qtapp.PNG
To obtain the element name, we find the caption/text of the control. If the control's caption/text is not available, we obtain the class name and it's number

In this case, the caption/text, classname/number are both available when the dialog is opened for the first time. Here is an image of the spytool when opened the first time:
spytool_before.PNG
When that dialog is closed and re-opened, the caption/text disappears and it never re-appears. It only re-appears when the entire application is closed and re-started. The class's number also changes. Here is an image of the spytool when the dialog is closed and re-opened:
spytool_after.PNG
How can we get the caption/text to stay, or have the class's number not change?

We have tried to get the grouping that surrounds the label, to find the label through it's parent, but unfortunately the grouping experiences the same property-changing behavior. This is one of many dialogs that exist in the application, yet this is the only dialog that we experiences this anomaly.

Re: Control Properties change in Qt Application

Posted: Thu May 12, 2011 10:48 am
by Support Team
jdres wrote:How can we get the caption/text to stay, or have the class's number not change?
The only thing to achieve that is to change the code of the control, I guess. It seems like the caption/text is only correctly set on the first time the dialog is shown.

You can try to identify the "ft" text element relatively from the "Length:" element. I.e. get the "Length:" text elements by its name and then get its siblings. One of the siblings should be the "ft" element.

With Ranorex 3.X (or even 2.X) I'd recommend to create a snapshot of the application in order to see the tree of elements inside that dialog, but that's not possible with 1.X. You might want to consider upgrading to a newer version; Ranorex 1.4 is out-of-date since 3 years now.

Regards,
Alex
Ranorex Team