From 10f5ccaab85e472bf8501a1db75ea30860174dfc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Sat, 30 Dec 2006 10:35:17 +0000 Subject: [PATCH] we've never used Q_FOREACH git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16437 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/QTocDialog.C | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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); } } -- 2.39.2