- Fix a crash when IN is clicked multiple time in a single line document.

- Polish the behavior when the TOC is empty (clearing the button and the TOC tree)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15373 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-19 14:35:06 +00:00
parent 8f426399d8
commit f23082917e
2 changed files with 9 additions and 1 deletions

View File

@ -58,6 +58,9 @@ QStandardItemModel * QToc::tocModel()
<< " toc_models_.size() " << toc_models_.size()
<< endl;
if (toc_models_.empty())
return 0;
BOOST_ASSERT(type_ >= 0 && type_ < int(toc_models_.size()));
return toc_models_[type_];
}
@ -118,8 +121,11 @@ void QToc::update()
type_ = 0;
vector<string> const & types = getTypes();
if (types.empty())
if (types.empty()) {
type_model_.setStringList(type_list);
toc_models_.clear();
return;
}
string const & selected_type = toc::getType(params().getCmdName());
lyxerr[Debug::GUI] << "selected_type " << selected_type << endl;

View File

@ -190,6 +190,8 @@ void QTocDialog::updateGui()
if (type_model->stringList().isEmpty())
{
enableButtons();
typeCO->setModel(type_model);
tocTV->setModel(new QStandardItemModel);
return;
}