3 #include <QApplication>
6 #include <QResizeEvent>
20 std::optional<SkillID>
23 if (shownSkill.has_value())
25 return shownSkill.value().skillId;
44 if (shownSkill.has_value())
46 auto remDesc = shownSkill.value().descr;
62 QTreeWidgetItem* aronTreeWidgetItem =
new QTreeWidgetItem(
this);
63 aronTreeWidgetItem->setText(0, QString::fromStdString(
"Parameters"));
65 aronTreeWidgetController = std::make_shared<AronTreeWidgetController>(
66 this, aronTreeWidgetItem, aron_args, default_args_of_profile);
73 shownSkill = {skillId, descr};
79 this->aronTreeWidgetController =
nullptr;
85 if (!shownSkill.has_value())
94 auto skillsMap =
memory->getSkills();
95 if (skillsMap.count(sid.
providerId.value()) == 0 ||
96 skillsMap.at(sid.
providerId.value()).count(sid) == 0)
108 SkillDetailsTreeWidget::setupUi()
110 this->setColumnCount(3);
112 this->setContextMenuPolicy(Qt::CustomContextMenu);
113 this->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
115 QTreeWidgetItem* qtreewidgetitem2 = this->headerItem();
116 qtreewidgetitem2->setText(3,
"defaultValue (hidden in GUI)");
117 qtreewidgetitem2->setText(2,
"Type");
118 qtreewidgetitem2->setText(1,
"Value");
119 qtreewidgetitem2->setText(0,
"Key");
121 setColumnHidden(3,
true);
133 const int widthRemainder = this->width() - typeWidth;
136 const int dynamicColumnSize = widthRemainder / 2;
140 this->setColumnWidth(0, dynamicColumnSize);
142 this->setColumnWidth(1, dynamicColumnSize);
149 if (aronTreeWidgetController)
151 return aronTreeWidgetController->convertToAron();
166 QClipboard* clipboard = QApplication::clipboard();
167 clipboard->setText(QString::fromStdString(json.dump(2)));
173 QClipboard* clipboard = QApplication::clipboard();
174 std::string
s = clipboard->text().toStdString();
175 nlohmann::json json = nlohmann::json::parse(
s);
179 if (!aronTreeWidgetController)
184 aronTreeWidgetController->setFromAron(
data);
194 if (!shownSkill.has_value())
215 aronTreeWidgetController =
nullptr;