| 753 | } |
| 754 | |
| 755 | void ParamEditor::storeRecursive_(QTreeWidgetItem * child, String path, map<String, String> & section_descriptions) |
| 756 | { |
| 757 | /** |
| 758 | |
| 759 | @todo: why would we "recreate" (setting restrictions etc) the the param object from scratch? |
| 760 | updating everything that changed seems the better option, as |
| 761 | this is more robust against additions to Param |
| 762 | |
| 763 | */ |
| 764 | child->setData(1, Qt::BackgroundRole, QBrush(Qt::white)); |
| 765 | |
| 766 | if (path.empty()) |
| 767 | { |
| 768 | path = child->text(0).toStdString(); |
| 769 | } |
| 770 | else |
| 771 | { |
| 772 | path += String(":") + String(child->text(0).toStdString()); |
| 773 | } |
| 774 | |
| 775 | String description = child->data(1, Qt::UserRole).toString(); |
| 776 | |
| 777 | std::vector<std::string> tag_list; |
| 778 | try // might throw ElementNotFound |
| 779 | { |
| 780 | tag_list = param_->getTags(path); |
| 781 | } |
| 782 | catch (...) |
| 783 | { |
| 784 | } |
| 785 | |
| 786 | if (child->text(2) == "") // node |
| 787 | { |
| 788 | if (!description.empty()) |
| 789 | { |
| 790 | section_descriptions.insert(make_pair(path, description)); |
| 791 | } |
| 792 | } |
| 793 | else //item + section descriptions |
| 794 | { |
| 795 | if (child->text(2) == "float") |
| 796 | { |
| 797 | param_->setValue(path, child->text(1).toDouble(), description, tag_list); |
| 798 | String restrictions = child->data(2, Qt::UserRole).toString(); |
| 799 | vector<String> parts; |
| 800 | if (restrictions.split(' ', parts)) |
| 801 | { |
| 802 | if (!parts[0].empty()) |
| 803 | { |
| 804 | param_->setMinFloat(path, parts[0].toDouble()); |
| 805 | } |
| 806 | if (!parts[1].empty()) |
| 807 | { |
| 808 | param_->setMaxFloat(path, parts[1].toDouble()); |
| 809 | } |
| 810 | } |
| 811 | } |
| 812 | else if (child->text(2) == "string") |
nothing calls this directly
no test coverage detected