Control Properties change in Qt Application

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
jdres
Posts: 3
Joined: Wed Jul 28, 2010 6:09 pm

Control Properties change in Qt Application

Post by jdres » Wed May 11, 2011 7:21 pm

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
qt app
qtapp.PNG (2.79 KiB) Viewed 1503 times
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
control before changed values
spytool_before.PNG (12.64 KiB) Viewed 1503 times
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
control after changed values
spytool_after.PNG (12.03 KiB) Viewed 1503 times
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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Control Properties change in Qt Application

Post by Support Team » Thu May 12, 2011 10:48 am

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
.
Image