Forum Discussion

jxgxldl's avatar
jxgxldl
Occasional Contributor
14 years ago

How to get the model of Qt widget

Hi, In the tested Qt-bassed application, I got one widget, it's a QTreeView object. and there are some items ( like folders and files ) in it.  Those items we called Model. It works like this in Qt:

 QFileSystemModel *model = new QFileSystemModel;
model->init(); // Initilize the model
QTreeView *tree = new QTreeView();
tree->setModel(model); // set the model.














So, In TestComplete, How to get the model ( itmes ) of QWidget ( eg: QTreeView ) ?

I used JScript:
var treeView = widget.QtObject("QTreeView","",1);
var treeItems = ???; // how to get it ?

1 Reply

  • Hi Dingliang,


    >> I got one widget, it's a QTreeView object

    TestComplete does not have special support for this control (see the "Working With Custom Controls" help topic).


    However, you can try working with it by using its native methods or properties. You can use the Object Browser (see the "Exploring Application Properties" help topic) to find necessary methods and properties.


    BTW, I recommend that you visit the following page of our web site:

    http://www.automatedqa.com/products/testcomplete/survey/

    and vote for your control. This way, implementing support for your control in one of future updates will get a higher priority.