27 #include <ArmarXGui/gui-plugins/StatechartEditorPlugin/ui_MultiProfileDefaultValueEditWidget.h>
34 QStringList profileNames,
35 QMap<QString, QString>
values,
40 typeString(typeString),
41 communicator(communicator)
48 QString jsonString = it.value();
49 if (!jsonString.isEmpty())
51 defaultEdits[it.key()] =
53 ui->splitter->addWidget(defaultEdits[it.key()].data());
56 ui->comboBoxProfiles->addItems(profileNames);
57 ui->comboBoxProfiles->setCurrentIndex(ui->comboBoxProfiles->count() - 1);
61 for (
auto name : profileNames)
63 if (defaultEdits.contains(name) && !defaultEdits[name].isNull() &&
64 defaultEdits[name]->getValueAsJson())
67 << defaultEdits[name]->getValueAsJson()->toStdString();
68 ui->comboBoxProfiles->setCurrentIndex(i);
73 delete ui->editWidget;
81 QMap<QString, VariantContainerBasePtr>
84 QMap<QString, VariantContainerBasePtr> result;
85 for (
auto it = defaultEdits.begin(); it != defaultEdits.end(); it++)
89 auto var = it.value().data()->getVariantContainer();
92 result[it.key()] = var;
99 QMap<QString, QString>
102 QMap<QString, QString> result;
103 for (
auto it = defaultEdits.begin(); it != defaultEdits.end(); it++)
105 std::optional<QString> json = it.value()->getValueAsJson();
108 result[it.key()] = *json;
115 MultiProfileDefaultValueEditWidget::on_comboBoxProfiles_currentIndexChanged(
const QString& arg1)
117 for (
const auto& it : defaultEdits)
125 if (!defaultEdits[arg1].isNull())
128 defaultEdits[arg1]->show();
133 new ProfileDefaultValueEditWidget(typeString,
"", communicator,
this);
134 ui->splitter->addWidget(defaultEdits[arg1].
data());