From: Peter Kümmel Date: Sat, 30 Dec 2006 10:35:17 +0000 (+0000) Subject: we've never used Q_FOREACH X-Git-Tag: 1.6.10~11415 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=10f5ccaab85e472bf8501a1db75ea30860174dfc;p=features.git we've never used Q_FOREACH git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16437 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/QTocDialog.C b/src/frontends/qt4/QTocDialog.C index 9264be428d..639cd21bcc 100644 --- a/src/frontends/qt4/QTocDialog.C +++ b/src/frontends/qt4/QTocDialog.C @@ -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); } }