5 #include "../../visitors/AronTreeWidgetCreator.h"
10 const std::string& label,
12 QTreeWidget* parent) :
18 widget.groupBoxInput->setTitle(QString::fromStdString(label));
22 connect(widget.pushButtonAddElement,
23 &QPushButton::clicked,
25 &AronTreeWidgetDictInputModalController::addEmptyElement);
27 connect(widget.pushButtonReset,
28 &QPushButton::clicked,
30 &AronTreeWidgetDictInputModalController::reset);
31 connect(widget.pushButtonSubmit,
32 &QPushButton::clicked,
34 &AronTreeWidgetDictInputModalController::submit);
38 AronTreeWidgetDictInputModalController::submit()
40 for (
const auto& added : addedItems)
49 AronTreeWidgetDictInputModalController::reset()
54 widget.treeWidgetDict->clear();
55 for (
int i = 0; i <
init.childCount(); ++i)
57 auto el =
init.child(i);
58 widget.treeWidgetDict->addTopLevelItem(el->clone());
63 AronTreeWidgetDictInputModalController::addEmptyElement()
65 QString
s = widget.lineEditKey->text();
66 widget.lineEditKey->setText(
"Enter Key");
68 if (widget.treeWidgetDict->findItems(
s, Qt::MatchFlag::MatchExactly, 0).empty())
72 auto ac = d->getAcceptedType();
74 AronTreeWidgetCreatorVisitor
v(
nullptr);
75 v.setTopLevelWidget(widget.treeWidgetDict);
78 if (
v.createdQWidgetItem)
82 addedItems.push_back(
v.createdQWidgetItem);
83 widget.treeWidgetDict->addTopLevelItem(
v.createdQWidgetItem);