5 #include "../../visitors/AronTreeWidgetCreator.h"
15 widget.groupBoxInput->setTitle(QString::fromStdString(label));
19 connect(widget.pushButtonAddElement, &QPushButton::clicked,
20 this, &AronTreeWidgetDictInputModalController::addEmptyElement);
22 connect(widget.pushButtonReset, &QPushButton::clicked,
23 this, &AronTreeWidgetDictInputModalController::reset);
24 connect(widget.pushButtonSubmit, &QPushButton::clicked,
25 this, &AronTreeWidgetDictInputModalController::submit);
29 void AronTreeWidgetDictInputModalController::submit()
31 for (
const auto& added : addedItems)
39 void AronTreeWidgetDictInputModalController::reset()
44 widget.treeWidgetDict->clear();
45 for (
int i = 0; i <
init.childCount(); ++i)
47 auto el =
init.child(i);
48 widget.treeWidgetDict->addTopLevelItem(el->clone());
52 void AronTreeWidgetDictInputModalController::addEmptyElement()
54 QString
s = widget.lineEditKey->text();
55 widget.lineEditKey->setText(
"Enter Key");
57 if (widget.treeWidgetDict->findItems(
s, Qt::MatchFlag::MatchExactly, 0).empty())
61 auto ac = d->getAcceptedType();
63 AronTreeWidgetCreatorVisitor
v(
nullptr);
64 v.setTopLevelWidget(widget.treeWidgetDict);
67 if (
v.createdQWidgetItem)
71 addedItems.push_back(
v.createdQWidgetItem);
72 widget.treeWidgetDict->addTopLevelItem(
v.createdQWidgetItem);