Forum Discussion

sameerjade's avatar
sameerjade
Frequent Contributor
3 years ago

How to add and identify custom Qt controls

Hello,

I am using TestComplete to test a desktop application. Object spy catches an entire box but no objects inside of it. It is Qt based. I already tried a a couple of ways but they are not working.

 

Object spy returns this with the box selection: 

Sys.Process("Abc").....QtObject("TreeView").QtObject("qt_scrollarea_viewport")

 

First I tried adding a custom Qt control in my projects object mapping page (based on the below link). After adding the custom control and saving, object spy still can't find the inside objects.
https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/qt.html

 

Then I tried using the Text Recognition Technology in TestComplete (based on the below link) 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. 

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/text-recognition/about.html

 

Any ideas how we can do this for Qt controls? Thanks!

13 Replies

    • sameerjade's avatar
      sameerjade
      Frequent Contributor

      Thanks Marsha! I checked the info in this link but can't find the solution to my problem. 

       

      To be more specific about the problem, we have 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.

       

      Thanks!

      • sameerjade's avatar
        sameerjade
        Frequent Contributor

        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!