summaryrefslogtreecommitdiff
path: root/src/gui/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/models')
-rw-r--r--src/gui/models/namesmodel.cpp11
-rw-r--r--src/gui/models/namesmodel.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/models/namesmodel.cpp b/src/gui/models/namesmodel.cpp
index ee26dbdaa..5344a7a7d 100644
--- a/src/gui/models/namesmodel.cpp
+++ b/src/gui/models/namesmodel.cpp
@@ -21,6 +21,7 @@
#include "gui/models/namesmodel.h"
#include "utils/cast.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
@@ -55,3 +56,13 @@ void NamesModel::fillFromArray(const char *const *const arr,
for (size_t f = 0; f < sz; f ++)
mNames.push_back(gettext(arr[f]));
}
+
+void NamesModel::fillFromVector(const StringVect &vect)
+{
+ FOR_EACH(StringVectCIter, it, vect)
+ {
+ const std::string str = *it;
+ if (!str.empty())
+ mNames.push_back(str);
+ }
+}
diff --git a/src/gui/models/namesmodel.h b/src/gui/models/namesmodel.h
index ba9a928a4..a239bd9aa 100644
--- a/src/gui/models/namesmodel.h
+++ b/src/gui/models/namesmodel.h
@@ -55,6 +55,8 @@ class NamesModel notfinal : public ListModel
void fillFromArray(const char *const *const arr,
const std::size_t size);
+ void fillFromVector(const StringVect &vect);
+
protected:
StringVect mNames;
};