* 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
This commit is contained in:
Stefan Schimanski 2008-03-05 12:02:18 +00:00
parent 1247839690
commit cafaf075e5

View File

@ -522,17 +522,24 @@ void GuiLayoutBox::addItemSort(docstring const & item, bool sorted)
return; 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 int i = 1; // skip the Standard layout
QString is = model_->item(i, 0)->text();
while (is.compare(titem) < 0) { QList<QStandardItem *> sep = model_->findItems("--", Qt::MatchStartsWith);
// e.g. --Separator-- if (!sep.isEmpty())
if (is[0].category() != QChar::Letter_Uppercase) i = sep.first()->index().row() + 1;
break; if (i < model_->rowCount()) {
++i; // find alphabetic position
if (i == end) QString is = model_->item(i, 0)->text();
break; while (is.compare(titem) < 0) {
is = model_->item(i, 0)->text(); // 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); model_->insertRow(i, row);