[LyX/master] Fixup refs sorting
Juergen Spitzmueller
spitz at lyx.org
Sun Dec 4 14:26:02 UTC 2022
commit 3ec87be05088d035bbe289dc12b55fb8a96b7282
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sun Dec 4 16:21:14 2022 +0100
Fixup refs sorting
This has been broken at df59649a18f
---
src/frontends/qt/GuiRef.cpp | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/frontends/qt/GuiRef.cpp b/src/frontends/qt/GuiRef.cpp
index 0e76f03..eff0917 100644
--- a/src/frontends/qt/GuiRef.cpp
+++ b/src/frontends/qt/GuiRef.cpp
@@ -435,7 +435,7 @@ void GuiRef::redoRefs()
QString const oldSelection(referenceED->text());
QStringList refsNames;
- QStringList refsAsStrings;
+ QMap<QString, QString> refsAsStrings;
QStringList refsCategories;
vector<std::pair<docstring, docstring>>::const_iterator iter;
bool noprefix = false;
@@ -444,7 +444,7 @@ void GuiRef::redoRefs()
QString const lab = toqstr((*iter).first);
refsNames.append(lab);
// the label as gui string
- refsAsStrings.append(toqstr((*iter).second));
+ refsAsStrings.insert(lab, toqstr((*iter).second));
if (groupCB->isChecked()) {
if (lab.contains(":")) {
QString const pref = lab.split(':')[0];
@@ -487,7 +487,8 @@ void GuiRef::redoRefs()
&& (!ref.mid(1).contains(":") || ref.left(1).contains(":")))) {
QTreeWidgetItem * child =
new QTreeWidgetItem(item);
- child->setText(0, refsAsStrings.at(j));
+ QString const val = refsAsStrings.value(ref, ref);
+ child->setText(0, val);
child->setData(0, Qt::UserRole, ref);
item->addChild(child);
}
@@ -500,7 +501,8 @@ void GuiRef::redoRefs()
for (int i = 0; i < refsNames.size(); ++i) {
QTreeWidgetItem * item = new QTreeWidgetItem(refsTW);
QString const & ref = refsNames.at(i);
- item->setText(0, refsAsStrings.at(i));
+ QString const val = refsAsStrings.value(ref, ref);
+ item->setText(0, val);
item->setData(0, Qt::UserRole, ref);
refsItems.append(item);
}
More information about the lyx-cvs
mailing list