diff options
-rw-r--r-- | src/Qt/helper.cpp | 28 | ||||
-rw-r--r-- | src/Qt/helper.h | 5 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/Qt/helper.cpp b/src/Qt/helper.cpp new file mode 100644 index 0000000..93a00fe --- /dev/null +++ b/src/Qt/helper.cpp @@ -0,0 +1,28 @@ +#include "helper.h" +#include <stringlist.h> + +QStringList CListToQStringList(StringList *clist) +{ + QStringList list; + + for (int i=0; i<stringListCount(clist); i++) { + list << stringListGetAt(clist, i); + } + + return list; +} + +StringList* QStringListToCList(const QStringList &list) +{ + StringList *clist; + + clist = stringListCreate(list.count()); + + if (clist) { // Not null + for (int i=0; i<list.count(); i++) { + stringListInsertAt(clist, i, list.at(i).toUtf8().data()); + } + } + + return clist; +} diff --git a/src/Qt/helper.h b/src/Qt/helper.h new file mode 100644 index 0000000..b45c14a --- /dev/null +++ b/src/Qt/helper.h @@ -0,0 +1,5 @@ +#include <QStringList> +#include <stringlist.h> + +QStringList CListToQStringList(StringList *); +StringList* QStringListToCList(const QStringList&);
\ No newline at end of file |