]> git.lyx.org Git - features.git/commitdiff
we've never used Q_FOREACH
authorPeter Kümmel <syntheticpp@gmx.net>
Sat, 30 Dec 2006 10:35:17 +0000 (10:35 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sat, 30 Dec 2006 10:35:17 +0000 (10:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16437 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/QTocDialog.C

index 9264be428ddb01cc0c03074da8d317f2ed1703b3..639cd21bcc92bb63f7ebfe2b6f593c7066991fc6 100644 (file)
@@ -106,16 +106,22 @@ void QTocDialog::setTreeDepth(int depth)
 {
        if(depth!=-1)
                depth_ = depth;
-//     tocTV->expandAll(); //expanding and then collapsing is probably better, but my qt 4.1.2 doesn't have expandAll()..
+
+       // expanding and then collapsing is probably better, 
+       // but my qt 4.1.2 doesn't have expandAll()..
+       //tocTV->expandAll(); 
        QModelIndexList indices = 
                form_->tocModel()->match(form_->tocModel()->index(0,0),
                                        Qt::DisplayRole, "*", -1, 
                                        Qt::MatchWildcard|Qt::MatchRecursive);
-       Q_FOREACH (QModelIndex index, indices) { // I had to use Q_FOREACH instead of foreach
-               if(getIndexDepth(index) < depth_) // because compile flag -DQT_NO_KEYWORDS doesn't allow me..
-                       tocTV->expand(index); 
+       
+       int size = indices.size();
+       for (int i = 0; i < size; i++) {
+               QModelIndex index = indices[i];
+               if (getIndexDepth(index) < depth_) 
+                       tocTV->expand(index); 
                else
-                       tocTV->collapse(index); 
+                       tocTV->collapse(index); 
        }
 }