Abdelrazak Younes wrote:
> As a side note, I don't like this slider so I didn't bother fixing it.
> IMHO it is not very useful as it is. I would prefer two up and down
> little arrows with an edit box indicating the depth. But even that is
> IMHO not very useful.
I'll commit the attached fix shortly. Took me quite a while to discover you
just swapped the logic ;-)
Now the most severe bug is the crash on moving entries up/down.
Jürgen
Index: src/frontends/qt4/QTocDialog.C
===================================================================
--- src/frontends/qt4/QTocDialog.C (Revision 13682)
+++ src/frontends/qt4/QTocDialog.C (Arbeitskopie)
@@ -181,7 +181,10 @@ void QTocDialog::updateToc(bool newdepth
if (iter->depth == 1) {
topLevelItem = new QTreeWidgetItem(tocTW);
topLevelItem->setText(0, toqstr(iter->str));
- if (iter->depth < depth_) tocTW->collapseItem(topLevelItem);
+ if (iter->depth > depth_)
+ tocTW->collapseItem(topLevelItem);
+ else if (iter->depth <= depth_)
+ tocTW->expandItem(topLevelItem);
lyxerr[Debug::GUI]
<< "Table of contents\n"
@@ -194,7 +197,7 @@ void QTocDialog::updateToc(bool newdepth
if (iter == form_->get_toclist().end())
break;
-
+
++iter;
}
@@ -204,9 +207,9 @@ void QTocDialog::updateToc(bool newdepth
tocTW->show();
}
-void QTocDialog::populateItem(QTreeWidgetItem * parentItem, toc::Toc::const_iterator& iter)
+void QTocDialog::populateItem(QTreeWidgetItem * parentItem, toc::Toc::const_iterator & iter)
{
- int curdepth = iter->depth+1;
+ int curdepth = iter->depth + 1;
QTreeWidgetItem * item;
while (iter != form_->get_toclist().end()) {
@@ -228,14 +231,17 @@ void QTocDialog::populateItem(QTreeWidge
item = new QTreeWidgetItem(parentItem);
item->setText(0, toqstr(iter->str));
- if (iter->depth < depth_) tocTW->collapseItem(item);
- else tocTW->expandItem(item);
+ if (iter->depth > depth_)
+ tocTW->collapseItem(item);
+ else if (iter->depth <= depth_)
+ tocTW->expandItem(item);
lyxerr[Debug::GUI]
<< "Table of contents: Added item " << iter->str
<< " at depth " << iter->depth
<< " \", parent \""
<< fromqstr(parentItem->text(0)) << '"'
+ << "expanded: " << tocTW->isItemExpanded(item)
<< endl;
populateItem(item, iter);