* QToc::update(): return early if no TOC type.
* QTocDialog::updateGui(): return early of the Type model is empty and disable the outline buttons.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15346
a592a061-630c-0410-9148-
cb99ea01b6c8
{
vector<string> const & types = getTypes();
+ if (types.empty())
+ return false;
+
BOOST_ASSERT(type_ >= 0 && type_ < int(types.size()));
return ControlToc::canOutline(types[type_]);
}
type_ = 0;
vector<string> const & types = getTypes();
+ if (types.empty())
+ return;
+
string const & selected_type = toc::getType(params().getCmdName());
lyxerr[Debug::GUI] << "selected_type " << selected_type << endl;
void QTocDialog::updateGui()
{
- typeCO->setModel(form_->typeModel());
- tocTV->setModel(form_->tocModel());
+ QStringListModel * type_model = form_->typeModel();
+ if (type_model->stringList().isEmpty())
+ {
+ enableButtons();
+ return;
+ }
+
+ typeCO->setModel(type_model);
+
+ if (form_->tocModel())
+ tocTV->setModel(form_->tocModel());
tocTV->showColumn(0);
// hide the pointless QHeader for now
// in the future, new columns may appear