Forum Discussion
Hello,
I am trying to pick objects inside of a Qt control. Object spy catches the entire box but is unable to catch the objects inside of it.
Object spy returns this with the box selection:
Sys.Process("Abc").....QtObject("TreeView").QtObject("qt_scrollarea_viewport")
This is a custom Qt control (or a derived class) which is derived from the base class "QWidget". When I go to "Object Mapping" in TestComplete, I can't find the base class "QWidget" and therefore cannot check the "derived classes" checkbox which may solve my problem. Under "Object Mapping" > "Qt Controls" > "Tree Widget", there is only one object "QTreeWidget".
Therefore my question is, how can I add my custom control or derived class which is derived from the base class "QWidget"? Or how can I make TestComplete catch the items inside of my custom control? Without this ability, my only option is to use xy coordinates on the control which makes my tests unstable and hard to maintain.
I also explored the option of using the "Text Recognition Technology" in TestComplete by calling the "TextObject" method but it looks like It must use the class name returned by the WndClass property of the object and since my control is Qt object it only has QtClass and therefore it is not able to invoke the TextObject method. Is there a way to use the "Text Recognition Technology" with Qt objects?
Thanks in advance!
Since they are the same question, I combined your two posts here.
Let's see a screenshot of your object mapping where the qt items are.
- sameerjade3 years agoFrequent Contributor
Attaching screenshot of my Object Mapping window:
- Marsha_R3 years agoChampion Level 3
And what happens when you try to add your custom control?
- sameerjade3 years agoFrequent Contributor
I tried adding the custom control in 2 ways:
1. First I tried adding a custom control "TreeWidget" under Qt Controls>Tree widget. After saving changes, I try to select my control using object spy but there is no change. It still cannot highlight the items inside my control.
2. Second I tried the first approach in the below link i.e. find your custom control's base class in the object mapping window and select the "derived classes" checkbox. This enables TestComplete to find your derived classes/custom controls from that base class. However, my base class is "QWidget" and this base class is not listed in the Object Mapping window, therefore I cannot do this approach.
Please let me know if I am missing something. Thanks!
Related Content
Recent Discussions
- 11 hours agoSvetaG