From: Stefan Schimanski Date: Wed, 5 Mar 2008 12:02:18 +0000 (+0000) Subject: * even when sorted alphabetically keep the separation of standard and module layouts X-Git-Tag: 1.6.10~5868 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=cafaf075e573a46adc6d35be4d90866c425b6df5;p=features.git * even when sorted alphabetically keep the separation of standard and module layouts git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23476 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 4c03b494da..680d45d19d 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -522,17 +522,24 @@ void GuiLayoutBox::addItemSort(docstring const & item, bool sorted) return; } - // find row to insert the item + // find row to insert the item, after the separator if it exists int i = 1; // skip the Standard layout - QString is = model_->item(i, 0)->text(); - while (is.compare(titem) < 0) { - // e.g. --Separator-- - if (is[0].category() != QChar::Letter_Uppercase) - break; - ++i; - if (i == end) - break; - is = model_->item(i, 0)->text(); + + QList sep = model_->findItems("--", Qt::MatchStartsWith); + if (!sep.isEmpty()) + i = sep.first()->index().row() + 1; + if (i < model_->rowCount()) { + // find alphabetic position + QString is = model_->item(i, 0)->text(); + while (is.compare(titem) < 0) { + // e.g. --Separator-- + if (is[0].category() != QChar::Letter_Uppercase) + break; + ++i; + if (i == end) + break; + is = model_->item(i, 0)->text(); + } } model_->insertRow(i, row);