----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, June 24, 2008 12:00 PM Subject: Qt-jambi-interest Digest, Vol 5, Issue 23
> Send Qt-jambi-interest mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest > or, via email, send a message with subject or body 'help' to > [EMAIL PROTECTED] > > You can reach the person managing the list at > [EMAIL PROTECTED] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Qt-jambi-interest digest..." > > > Today's Topics: > > 1. Re: ListView, move item instead copy (Dawid Sip) > 2. Re: How can I update the QTreeView/QTreeModel if my Data > changes (Waldemar Wittmann) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 23 Jun 2008 15:12:37 +0200 > From: Dawid Sip <[EMAIL PROTECTED]> > Subject: Re: [Qt-jambi-interest] ListView, move item instead copy > To: [email protected] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-2; format=flowed > > Gunnar Sletta pisze: >> Hi Dawid, >> >> Drag and Drop on ListView is not working according to the docs. I've >> filed a bug with the itemviews guys. >> >> best regards, >> Gunnar >> > Hm, according to the docs drag&drop should work in ListView. I have read > this Section: > http://doc.trolltech.com/4.4/model-view-dnd.html > I need the inter drag&drop, so that it works inside one ListView. > > Have You tryed the example I've sent? You can move the items. DnD works > but in a CopyAction mode.. > > regards, > Dave > > > ------------------------------ > > Message: 2 > Date: Tue, 24 Jun 2008 03:08:45 +0200 > From: Waldemar Wittmann <[EMAIL PROTECTED]> > Subject: Re: [Qt-jambi-interest] How can I update the > QTreeView/QTreeModel if my Data changes > To: [email protected] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="utf-8" > > Am Montag, den 23.06.2008, 09:20 +0200 schrieb Gunnar Sletta: >> Waldemar Wittmann wrote: >> > Hi all, >> > >> > i am vizualising a real Tree Datastructure. It's a binary Tree where >> > each Node ?has always 2 Childs (leafs have 0 childs) and one parent (in >> > the case of the root node no parent). >> > I have extended QTreeView and I extended QTreeModel. The problem is, >> > the >> > Tree Datastructure changes, for example new nodes are inserted or nodes >> > are deleted and i want to see immediately the changes in the QTreeView >> > without clicking (it's a vizualisation). >> > My tree-node class extends the QSignalEmitter and sends signals to my >> > methods in the extended QTreeModel class. So i have the required >> > information on which node the change is, for example that a node had 0 >> > childs and now 2 childs. >> > I looked for Methods how to inform the QTreeModel or the QTreeView >> > about >> > the changes but didn't really find them. I tried the following in the >> > slot method (the signals from the tree-nodes are connected with this >> > method) in my extended QTreeModel class: >> > >> Hi Waldemar, >> >> The methods you are looking for are childrenInserted and childrenRemoved: >> >> http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QTreeModel.html#childrenInserted(com.trolltech.qt.core.QModelIndex,%20int,%20int) >> http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QTreeModel.html#childrenRemoved(com.trolltech.qt.core.QModelIndex,%20int,%20int) >> >> As for the Treemodel file example, its more an example bug. The example >> should really listen to filesystem using QFileSystemWatcher and updated >> repeadedly but it currently doesn't ;-) >> >> The attached example illustrates adding and removing items >> programatically. >> >> best regards, >> Gunnar > > ?Hi all, > Gunnar, thank you very much for your answer and your example :) > > 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? > > 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? > That was the reason why I thought there is no suitable method in the > QTreeModel for the insertion. I tried to use the childrenInserted Method > but didn't see the insertion ... > What I do now for my tree is simply calling expand(i); after the > insertion: > > ?model.childrenInserted(i, l, r); > expand(i); > > I keep my tree alway expanded, because i want to see ?always the whole > tree. If someone doesn't want to keep the tree expanded but wants to see > that after the insertion the node is expandable could do simply > something like that: > > Node n = (Node) model.indexToValue(i); > //before the insertion: > size = n.children.size(); > // <- here should be the code for the insertion of r-l+1 Elements into > node n > model.childrenInserted(i, l, r); > if(size==0) { > expand(i); > collapse(i); > } > > ?The ?childrenRemoved method updates the tree and the childrens and the > whole tree under them disappear. That is working. > > 3) > My tree datastructure is doing Rotations. So a node n with QModelIndex i > becomes the two subtrees of two other nodes one/two levels under it. I > handle it with > > childrenRemoved(i, 0, 1); > childrenInserted(i, 0, 1); > treeView.expand(i); > > it seems to work. the view seemingly builds the tree below "i" new. My > problem is that only the node "i" expands. I want to see always the > whole tree expanded. Under "i" could be a bigger subtree. Is there an > other possibility to solve it excepting treeView.expandAll(); ? > The expandAll(); method costs a lot of time and performance how i have > 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? > > 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? > > 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. > > 6) > How must I modify my extended QTreeView class, so that the tree > structure is painted like a tree datastructure: > for example: > > ?not: > > root > |-root.l > | |-root.l.l > | |-root.l.r > |-root.r > |-root.r.l > | |-root.r.l.l > | |-root.r.l.r > |-root.r.r > > but: > |-root.l.l > |-root.l-| > | |-root.l.r > root-| > | |-root.r.l.l > | |?-root.r.l-| > | | |-root.r.l.r > |-root.r-| > |-root.r.r > > see appendix, if the trees are blurred. > > sorry, for so many questions. but i think that would be all for now ;) > > best regards, > Waldemar > -------------- next part -------------- > root > |-root.l > | |-root.l.l > | |-root.l.r > |-root.r > |-root.r.l > | |-root.r.l.l > | |-root.r.l.r > |-root.r.r > > > |-root.l.l > |-root.l-| > | |-root.l.r > root-| > | |-root.r.l.l > | |?-root.r.l-| > | | |-root.r.l.r > |-root.r-| > |-root.r.r > > ------------------------------ > > _______________________________________________ > Qt-jambi-interest mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest > > > End of Qt-jambi-interest Digest, Vol 5, Issue 23 > ************************************************ _______________________________________________ Qt-jambi-interest mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
