Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, May 2007
QTreeModel - childrenInserted


Message 1 in thread

Hi,
well I think there's something wrong with QTreeModel.childrenInserted().
I can only insert childs one by one. If I try to insert more of them,
I got something like
"QTreeModel::childrenInserted(), bad input, first=0, last=201,
childCount=0".
I have looked in QTreeModel source - childrenInserted is using the
old/cached children count and so refuses to use any 'last' bigger then OLD
children count
Jakub


Message 2 in thread

Jakub Dvorak wrote:
> Hi,
> well I think there's something wrong with QTreeModel.childrenInserted().
> I can only insert childs one by one. If I try to insert more of them,
> I got something like
> "QTreeModel::childrenInserted(), bad input, first=0, last=201,
> childCount=0".
> I have looked in QTreeModel source - childrenInserted is using the
> old/cached children count and so refuses to use any 'last' bigger then OLD
> children count
> Jakub

Hi Jakub,

This check is bogus.... The attached patch removes it and makes 
insertion of multiple items possible.

best regards,
Gunnar


Change 262582 by qt@surpomp on 2007/05/03 22:59:03
Change 262582 by qt@surpomp on 2007/05/03 22:59:03

	Username: gunnar
	Fixes:    bad check in childrenInserted

Affected files ...

... //depot/qtjambi/main/qtjambi_gui/qtreemodel.cpp#11 edit

Differences ...

==== //depot/qtjambi/main/qtjambi_gui/qtreemodel.cpp#11 (text) ====

@@ -303,7 +303,7 @@
 {
     Node *parentNode = node(parentIndex);
 
-    if (first < 0 || last > parentNode->nodes.size() || first > last) {
+    if (first < 0 || first > last) {
         printf("QTreeModel::childrenInserted(), bad input, first=%d, last=%d, childCount=%d\n",
                first, last, parentNode->nodes.size());
         return;