]> git.lyx.org Git - features.git/commitdiff
- Fix a crash when IN is clicked multiple time in a single line document.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 19 Oct 2006 14:35:06 +0000 (14:35 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 19 Oct 2006 14:35:06 +0000 (14:35 +0000)
- 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

src/frontends/qt4/QToc.C
src/frontends/qt4/QTocDialog.C

index a85e961741b92b09a20edf5685f4a874c3e875ab..8c43bc4a4b15f0844649811b39c667ea330aca16 100644 (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;
index 34556d96732df8be1a16820cd07321ab289d2e09..9ebcd8b9de832ceb1f020cfef4d9b255118fe3e0 100644 (file)
@@ -190,6 +190,8 @@ void QTocDialog::updateGui()
        if (type_model->stringList().isEmpty())
        {
                enableButtons();
+               typeCO->setModel(type_model);
+               tocTV->setModel(new QStandardItemModel);
                return;
        }