Skip to content
Snippets Groups Projects

Add a named group box for lists if element type not in implementedListDescriptors

Merged Rainer Kartmann requested to merge aron-remote-gui-group-box-for-listz into master
1 file
+ 46
23
Compare changes
  • Side-by-side
  • Inline
@@ -167,39 +167,62 @@ namespace armarx::aron::component_config
MakeConfigGuiVisitor::visitListOnEnter(DataInput& o, TypeInput& t)
{
in_list_ = true;
auto group = RemoteGui::makeSimpleGridLayout(pathToName(o) + "_grid").cols(20);
auto data = data::List::DynamicCastAndCheck(o);
auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor();
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) ==
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
implementedListDescriptors.end())
{
return;
auto group = RemoteGui::makeSimpleGridLayout(pathToName(o) + "_grid").cols(20);
auto data = data::List::DynamicCastAndCheck(o);
for (const auto& el : data->getElements())
{
group.addChild(RemoteGui::makeLineEdit(pathToName(el))
.value(factories::VariantHelper::make(type)->to_string(el)),
10);
group.addHSpacer(8);
group.addChild(RemoteGui::makeButton(pathToName(el) + "_button")
.label("-")
.toolTip("Remove List Element"),
2);
}
group_hierarchy_.back()->addChild(
RemoteGui::makeGroupBox(pathToName(o) + "_grp")
.label(o->getPath().getLastElement())
.collapsed(true)
.addChild(group)
.addChild(RemoteGui::makeButton(pathToName(o) + "_add")
.label("+")
.toolTip("Add new list entry.")));
}
for (const auto& el : data->getElements())
else
{
group.addChild(RemoteGui::makeLineEdit(pathToName(el))
.value(factories::VariantHelper::make(type)->to_string(el)),
10);
group.addHSpacer(8);
group.addChild(RemoteGui::makeButton(pathToName(el) + "_button")
.label("-")
.toolTip("Remove List Element"),
2);
std::string name = pathToName(o);
group_hierarchy_.emplace_back(std::make_shared<RemoteGui::detail::GroupBoxBuilder>(
RemoteGui::makeGroupBox(name)));
}
group_hierarchy_.back()->addChild(
RemoteGui::makeGroupBox(pathToName(o) + "_grp")
.label(o->getPath().getLastElement())
.collapsed(true)
.addChild(group)
.addChild(RemoteGui::makeButton(pathToName(o) + "_add")
.label("+")
.toolTip("Add new list entry.")));
}
void
MakeConfigGuiVisitor::visitListOnExit(DataInput& /*unused*/, TypeInput& /*unused*/)
MakeConfigGuiVisitor::visitListOnExit(DataInput& /*unused*/, TypeInput& t)
{
in_list_ = false;
auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor();
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
implementedListDescriptors.end())
{
}
else
{
auto builder = *group_hierarchy_.back();
group_hierarchy_.pop_back();
if (not group_hierarchy_.empty())
{
group_hierarchy_.back()->addChild(builder);
}
}
}
void
@@ -232,7 +255,7 @@ namespace armarx::aron::component_config
group.addChild(RemoteGui::makeLabel(name + "_label").value(q->getPath().getLastElement()));
group.addHSpacer();
if (cols == 4 && rows == 4)
if (cols == 4 and rows == 4)
{
// Poses
const auto& matrix = aron::data::converter::AronEigenConverter::ConvertToMatrix4f(data);
Loading