Incomplete TocDialog slider implementation from Ugras Baran.

* QTocDialog::getIndexDepth(): new method.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15956 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-11-17 17:19:43 +00:00
parent 4f5432f427
commit 2ea833ac71
3 changed files with 51 additions and 28 deletions

View File

@ -51,32 +51,17 @@ BIBLIOGRAPHY
TABLE OF CONTENTS
* In the TOC dialog, switching between the different TOC types (TOC, Table,
Float, etc.) is broken.
* In the TOC dialog, the slider for altering the display level is
non-functional (not implemented).
* TOC crashes (simply make a few sections, subsections, sections; then add TOC
before all sections and click on the left button)
* Items in the TOC cannot be moved using drag & drop (Joost 4/11/06).
* In TOC, the buttons "Up", "Down", "Promote", and "Demote" are not
self-explaining. Why don't we group them in two pairs: Section Up/Down, Level
Up/Down? The arrangement of the buttons may also give some hint to the user.
* The correct list is not selected when right-clicking on a LOF or
LOT inset.
* When selecting a type which *is* already selected, the content in the
browser window vanishes
* The items in the treeview are editable
* When content (sections/captions) is changed, the toc/lof/lot is not properly
updated.
Abdel 2006-11-17: This one is not as simple as it seems as it involves a
TocBackend update at each keystroke. Unless we manage to update a specific
TocItem, this will be a WONTFIX for 1.5.0.
DIALOGS
@ -382,3 +367,26 @@ CREDITS:
3. add a bibliography
4. View Source ->crash
FIXED (Peter 2006-11-14)
* In the TOC dialog, switching between the different TOC types (TOC, Table,
Float, etc.) is broken.
FIXED (Ugras)
* In the TOC dialog, the slider for altering the display level is
non-functional (not implemented).
FIXED (Ugras 2006-11-17)
* The correct list is not selected when right-clicking on a LOF or
LOT inset.
FIXED (Ugras 2006-11-17)
* When selecting a type which *is* already selected, the content in the
browser window vanishes
FIXED (Ugras 2006-11-17)
* TOC crashes (simply make a few sections, subsections, sections; then add TOC
before all sections and click on the left button)
FIXED (Abdel, sometimes in november 2006).
* Items in the TOC cannot be moved using drag & drop (Joost 4/11/06).
WONTFIX (Abdel 2006-11-17): at least not for 1.5.0, this is just candy anyway.

View File

@ -79,7 +79,18 @@ void QTocDialog::on_closePB_clicked()
void QTocDialog::on_updatePB_clicked()
{
form_->update();
update();
}
/* FIXME (Ugras 17/11/06):
I have implemented a getIndexDepth function to get the model indices. In my
opinion, somebody should derive a new qvariant class for tocModelItem
which saves the string data and depth information. that will save the
depth calculation.
*/
int QTocDialog::getIndexDepth(QModelIndex const & index, int depth){
++depth;
return (index.parent() == QModelIndex())? depth : getIndexDepth(index.parent(),depth);
}
@ -89,15 +100,17 @@ void QTocDialog::on_depthSL_valueChanged(int depth)
return;
depth_ = depth;
/*
while (
tocTv->setExpanded();
if (iter->depth() > depth_)
tocTV->collapseItem(topLevelItem);
else if (iter->depth() <= depth_)
tocTV->expandItem(topLevelItem);
*/
// tocTV->expandAll(); //expanding and then collapsing is probably better, but my qt 4.1.2 doesn't have 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);
else
tocTV->collapse(index);
}
}

View File

@ -73,6 +73,8 @@ protected:
void enableButtons(bool enable = true);
/// Reconnects the selection model change signal when TOC changed.
void reconnectSelectionModel();
///
int getIndexDepth(QModelIndex const & index, int depth = -1);
private: