From fba67710d8f658495180ab3d19235f4dcd6308f3 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 3 May 2020 09:44:55 +0200 Subject: [PATCH] Make counter items translatable and sort properly --- src/frontends/qt/GuiCounter.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp index 9b8fbb666d..5ab3bbfcec 100644 --- a/src/frontends/qt/GuiCounter.cpp +++ b/src/frontends/qt/GuiCounter.cpp @@ -25,6 +25,8 @@ #include "support/gettext.h" #include "support/lstrings.h" +#include "qt_helpers.h" + #include //#include @@ -88,10 +90,15 @@ void GuiCounter::fillCombos() Counters const & cntrs = bv->buffer().params().documentClass().counters(); std::vector counts = cntrs.listOfCounters(); + // We use an intermediate map in order to sort at translated GUI strings. + QMap items; for (auto const & c : counts) { docstring const & guiname = cntrs.guiName(c); - counterCB->addItem(toqstr(guiname), toqstr(c)); + items.insert(qt_(toqstr(guiname)), toqstr(c)); } + for (QMap::const_iterator it = items.constBegin(); + it != items.constEnd(); ++it) + counterCB->addItem(it.key(), it.value()); } -- 2.39.2