Waldemar Wittmann wrote:
> 1)
> You used the
>
> model.dataChanged.emit(i, i);
>
> signal to update the node (text) in the view. Calling the
>
> view.update(i);
>
> method works too, or should i better use the signal? makes this a
> difference? 
>   

The dataChanged signal in the model will alert anyone who's listening 
that the data has changed. The update() method in the view only posts a 
paint event to the widget, causing it to be repainted. If the data in 
the model changes, you should emit the signal, as there is no guarantee 
that a repaint will actually have the effect you want (could be cached 
for instance) and there may be other objects listening for a data change.

> 2)
> Perhaps you can see in the application you sent that inserting into a
> node without children doesn't update the node. You don't see after
> inserting, that you can expand it. Not until you click on it or
> somewhere else. Is it a Bug?
>   

Yes, I believe this is related to an issue in Qt:

    
http://trolltech.com/developer/task-tracker/index_html?id=216717&method=entry

The fix is scheduled for Qt 4.4.1. The next planned patch release of Qt 
Jambi is Qt Jambi 4.4.2, where the fix should also be present.

> seen during tests. For example I have 500 Nodes in my tree and the whole
> tree is expanded. After the rotation i do the operations
> (childrenRemoved, childrenInserted, expand) on a node with about 10
> nodes under it. Now i can only see the two children of n. and only a few
> nodes should be expanded that the whole tree is expanded. but if i do
> now expandAll() it seems that it goes top down through all nodes and
> tries to expand them? looks like that because the cpu load goes high. is
> it possible to full expand the subtree under a node with less cpu load?
> how?
>   

There is no convenience method for this in the QTreeView API, so I 
believe you will have to do it manually.

You might be able to use the "expanded" signal. This is emitted every 
time a node is expanded, so you could maybe listen to it and expand the 
children of a node whenever it is expanded.

> 4)
> I want to have 2 different modes how to display the text of all nodes in
> the tree. i switch in my model.text(Object o) method between them. I
> want that the whole tree displays immediately the Text of all Nodes in
> the selected mode. I change the mode in the text(Object o) method and do
> an treeView.collapseAll() and treeView.expandAll(). It works but is
> there a better possibility to update the text of all nodes of the whole
> tree in the view?
>   

The reset() method in QTreeModel tells the view that it has to requery 
the model for everything.

You can also emit the dataChanged signal on your top level items, and 
this will recursively refresh all items in the view.

> 5)
> The QTreeModel class is not included in Qt, so there must be a
> QTreeModel.java file, but i could not find it in the source download of
> qt jambi.
>   

It's a JNI-based C++ file written specifically for Qt Jambi. It's 
located in

    path/to/jambi/qtjambi_gui/qtreemodel.*

> 6)
> How must I modify my extended QTreeView class, so that the tree
> structure is painted like a tree datastructure:
>   

I'm afraid this is not supported by QTreeView, so you will need to 
implement this yourself.

-- Eskil


_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to