Showing results for 
Search instead for 
Did you mean: 

How to get the model of Qt widget

Occasional Contributor

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 ?

RE: How to get the model of Qt widget

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:

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

Best regards,

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Top Kudoed Authors