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()
51 AronTreeWidgetDictInputModalController::reset()
56 widget.treeWidgetDict->clear();
57 for (
int i = 0; i <
init.childCount(); ++i)
59 auto el =
init.child(i);
60 widget.treeWidgetDict->addTopLevelItem(el->clone());
65 AronTreeWidgetDictInputModalController::addEmptyElement()
67 QString
s = widget.lineEditKey->text();
68 widget.lineEditKey->setText(
"Enter Key");
70 if (widget.treeWidgetDict->findItems(
s, Qt::MatchFlag::MatchExactly, 0).empty())
74 auto ac = d->getAcceptedType();
76 AronTreeWidgetCreatorVisitor
v(
nullptr);
77 v.setTopLevelWidget(widget.treeWidgetDict);
80 if (
v.createdQWidgetItem)
84 addedItems.push_back(
v.createdQWidgetItem);
85 widget.treeWidgetDict->addTopLevelItem(
v.createdQWidgetItem);