Leftover.

This commit is contained in:
Pavel Sanda 2012-11-04 01:29:08 +01:00
parent 4a0911f25e
commit 38c836f65d

View File

@ -291,27 +291,10 @@ void TocWidget::setTreeDepth(int depth)
if (!tocTV->model()) if (!tocTV->model())
return; return;
#if QT_VERSION >= 0x040300
// this should be faster than our own code below
if (depth == 0) if (depth == 0)
tocTV->collapseAll(); tocTV->collapseAll();
else else
tocTV->expandToDepth(depth - 1); tocTV->expandToDepth(depth - 1);
#else
// expanding and then collapsing is probably better,
// but my qt 4.1.2 doesn't have expandAll()..
//tocTV->expandAll();
QModelIndexList indices = tocTV->model()->match(
tocTV->model()->index(0, 0),
Qt::DisplayRole, "*", -1,
Qt::MatchFlags(Qt::MatchWildcard|Qt::MatchRecursive));
int size = indices.size();
for (int i = 0; i < size; i++) {
QModelIndex index = indices[i];
tocTV->setExpanded(index, indexDepth(index) < depth_);
}
#endif
} }