diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-03-31 13:25:20 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-03-31 13:29:52 (GMT) |
commit | b92fe0b47d519da5fd55ba55ad0838e1ff69195c (patch) | |
tree | f0ef2e0c818309fdffbd3ad004ef940aacf8817f | |
parent | 723176efd7532edbce9a27a3433bb63186568327 (diff) | |
download | swift-contrib-b92fe0b47d519da5fd55ba55ad0838e1ff69195c.zip swift-contrib-b92fe0b47d519da5fd55ba55ad0838e1ff69195c.tar.bz2 |
Render results forms with multi-values correctly
Change-Id: I3b3de9687e8f2f2f6d478a52ffd92e383bcd4b08
-rw-r--r-- | Swift/QtUI/QtFormWidget.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Swift/QtUI/QtFormWidget.cpp b/Swift/QtUI/QtFormWidget.cpp index 117696d..874c8a1 100644 --- a/Swift/QtUI/QtFormWidget.cpp +++ b/Swift/QtUI/QtFormWidget.cpp @@ -59,4 +59,11 @@ QListWidget* QtFormWidget::createList(FormField::ref field) { listWidget->setSelectionMode(field->getType() == FormField::ListMultiType ? QAbstractItemView::MultiSelection : QAbstractItemView::SingleSelection); std::vector<bool> selected; + /* if this is an editable form, use the 'options' list, otherwise use the 'values' list */ + if (form_->getType() != Form::FormType) { + foreach (const std::string& value, field->getValues()) { + listWidget->addItem(P2QSTRING(value)); + selected.push_back(false); + } + } else { foreach (FormField::Option option, field->getOptions()) { listWidget->addItem(option.label.c_str()); @@ -68,5 +75,5 @@ QListWidget* QtFormWidget::createList(FormField::ref field) { selected.push_back(std::find(field->getValues().begin(), field->getValues().end(), text) != field->getValues().end()); } - + } } for (int i = 0; i < listWidget->count(); i++) { |