From e9cc697b60522011b53c9816bb942db6305cc869 Mon Sep 17 00:00:00 2001 From: Doc West Date: Tue, 3 Jul 2018 00:52:23 +0200 Subject: [PATCH] Sort EnumDelegate values by name --- apps/opencs/view/world/enumdelegate.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/world/enumdelegate.cpp b/apps/opencs/view/world/enumdelegate.cpp index 4bd40b830..c303b71ac 100644 --- a/apps/opencs/view/world/enumdelegate.cpp +++ b/apps/opencs/view/world/enumdelegate.cpp @@ -175,5 +175,16 @@ CSVWorld::CommandDelegate *CSVWorld::EnumDelegateFactory::makeDelegate ( void CSVWorld::EnumDelegateFactory::add (int value, const QString& name) { - mValues.push_back (std::make_pair (value, name)); + auto pair = std::make_pair (value, name); + + for (auto it=mValues.begin(); it!=mValues.end(); ++it) + { + if (it->second > name) + { + mValues.insert(it, pair); + return; + } + } + + mValues.push_back(std::make_pair (value, name)); }