[Qt-interest] update an existing item in QTreeWidget without user intervension

Sarvesh Saran Sarvesh.Saran at synopsys.com
Sat Apr 17 16:27:54 CEST 2010


Hi,

I have a QTreeWidget containing hundreds of rows. The items corresponding to each row are updated by receiving and parsing data from an external process..

For example, the columns in my tree widget are:

Name of machine  Available-memory(GB)  load-average

This is how my tree widget looks after I have receive the initial data (data is read through a socket, and is a string of format "cluster1 machine1 1.2 5.0")

Cluster 1
                Machine1 1.2  5.0
                Machine2 4.8 3.1
                ...
                ....
                .....
                Machine500 2.0 0.1
Cluster 2
                Machine501 1.1 8
                .....
                Machine1000 1.2 0.1

Later on, I get the following data update "cluster 1 Machine1 1.2 9.0" .This warrants an update of the tree widget.

I have to first check if an item containing the name "Machine1" in first column exists. If yes, update it. If no, create a new child using cluster 1 as parent.

I'm not sure how to search for an item based on a data ( a name in this case)? I am also concerned about the time complexity of searching through all child items (there could be thousands).

Thanks,
Sarvesh






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100417/0199f8cc/attachment.html 


More information about the Qt-interest-old mailing list