AronTreeWidgetDictInputModalController.cpp
Go to the documentation of this file.
2
4
6
7namespace armarx
8{
10 const std::string& label,
12 QTreeWidget* parent) :
13 AronTreeWidgetModal(label, item, parent)
14 {
15 widget.setupUi(this);
16
17 // set header
18 widget.groupBoxInput->setTitle(QString::fromStdString(label));
19 reset();
20
21 // connect signals
22 connect(widget.pushButtonAddElement,
23 &QPushButton::clicked,
24 this,
25 &AronTreeWidgetDictInputModalController::addEmptyElement);
26
27 connect(widget.pushButtonReset,
28 &QPushButton::clicked,
29 this,
30 &AronTreeWidgetDictInputModalController::reset);
31 connect(widget.pushButtonSubmit,
32 &QPushButton::clicked,
33 this,
34 &AronTreeWidgetDictInputModalController::submit);
35 }
36
37 void
38 AronTreeWidgetDictInputModalController::submit()
39 {
40 for (const auto& added : addedItems)
41 {
42 //item->addChild(added->copy());
43 }
44
46 }
47
48 void
49 AronTreeWidgetDictInputModalController::reset()
50 {
52
53 // reset to initial value
54 widget.treeWidgetDict->clear();
55 for (int i = 0; i < init.childCount(); ++i)
56 {
57 auto el = init.child(i);
58 widget.treeWidgetDict->addTopLevelItem(el->clone());
59 }
60 }
61
62 void
63 AronTreeWidgetDictInputModalController::addEmptyElement()
64 {
65 QString s = widget.lineEditKey->text();
66 widget.lineEditKey->setText("Enter Key");
67
68 if (widget.treeWidgetDict->findItems(s, Qt::MatchFlag::MatchExactly, 0).empty())
69 {
70 auto t = item->aronType;
72 auto ac = d->getAcceptedType();
73
74 AronTreeWidgetCreatorVisitor v(nullptr);
75 v.setTopLevelWidget(widget.treeWidgetDict);
76 aron::type::visit(v, ac);
77
78 if (v.createdQWidgetItem)
79 {
81 s);
82 addedItems.push_back(v.createdQWidgetItem);
83 widget.treeWidgetDict->addTopLevelItem(v.createdQWidgetItem);
84 }
85 }
86 }
87} // namespace armarx
AronTreeWidgetDictInputModalController(const std::string &label, AronTreeWidgetItem *item, QTreeWidget *parent)
AronTreeWidgetModal(const std::string &label, AronTreeWidgetItem *item, QTreeWidget *parent)
static std::shared_ptr< Dict > DynamicCastAndCheck(const VariantPtr &n)
void visit(VisitorImplementation &v, typename VisitorImplementation::Input &t)
The visit function.
Definition Visitor.h:39
double s(double t, double s0, double v0, double a0, double j)
Definition CtrlUtil.h:33
double v(double t, double v0, double a0, double j)
Definition CtrlUtil.h:39
This file offers overloads of toIce() and fromIce() functions for STL container types.