* TocWidget.cpp:

- improve performance with Outliner open with Qt >= 4.3 by using native methods instead of home-brewn code.
	  This should especially pay off on the Mac, if the Outliner shows as a drawer (bug 4443).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28432 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-02-10 08:32:34 +00:00
parent ba2080fb19
commit 0c3109e2d3

View File

@ -142,6 +142,13 @@ void TocWidget::setTreeDepth(int depth)
if (!tocTV->model())
return;
#if QT_VERSION >= 0x040300
// this should be faster than our own code below
if (depth == 0)
tocTV->collapseAll();
else
tocTV->expandToDepth(depth - 1);
#else
// expanding and then collapsing is probably better,
// but my qt 4.1.2 doesn't have expandAll()..
//tocTV->expandAll();
@ -155,6 +162,7 @@ void TocWidget::setTreeDepth(int depth)
QModelIndex index = indices[i];
tocTV->setExpanded(index, indexDepth(index) < depth_);
}
#endif
}