SkillTreeWidget.h
Go to the documentation of this file.
1 #ifndef ARMARX_SKILLS_GUI_SKILLTREEWIDGET_H
2 #define ARMARX_SKILLS_GUI_SKILLTREEWIDGET_H
3 
4 #include <QTreeWidget>
5 
7 
8 #include "../memory/MemoryCommunicatorBase.h"
9 
10 namespace armarx::skills::gui
11 {
12  using SkillMap =
13  std::map<skills::ProviderID, std::map<skills::SkillID, skills::SkillDescription>>;
14 
15  class SkillTreeWidget : public QTreeWidget, public MemoryCommunicatorBase
16  {
17  Q_OBJECT
18  public:
19  SkillTreeWidget(std::shared_ptr<SkillManagerWrapper> _memory, QWidget* parent = nullptr) :
20  QTreeWidget(parent), MemoryCommunicatorBase(_memory)
21  {
22  setupUi();
23  }
24 
26  {
28 
29  // make default constructable
31  skillId({.providerId = std::nullopt, .skillName = skills::SkillID::UNKNOWN})
32  {
33  }
34  };
35 
36  SelectedSkill& getSelectedSkill();
37 
38  signals:
39  /**
40  * @brief Notify the skill description widget of an updated selection.
41  * @param skillId
42  */
43  void updateSkillDetails(skills::SkillID& skillId);
44 
45  public slots:
46  void disconnectGui();
47 
49 
50  private slots:
51  void skillSelectionChanged(QTreeWidgetItem* current, int column);
52 
53 
54  private:
55  SelectedSkill selectedSkill;
56 
57  static const constexpr bool PROVIDER_EXPANDED_DEFAULT = true;
58 
59  void setupUi();
60  void connectSignals();
61  };
62 
63 } // namespace armarx::skills::gui
64 
65 #endif // ARMARX_SKILLS_GUI_SKILLTREEWIDGET_H
armarx::skills::gui::SkillTreeWidget::SelectedSkill::skillId
skills::SkillID skillId
Definition: SkillTreeWidget.h:27
SkillID.h
armarx::skills::gui::SkillTreeWidget::getSelectedSkill
SelectedSkill & getSelectedSkill()
armarx::skills::gui::SkillTreeWidget::updateSkillDetails
void updateSkillDetails(skills::SkillID &skillId)
Notify the skill description widget of an updated selection.
armarx::skills::SkillID::UNKNOWN
static const constexpr char * UNKNOWN
Definition: SkillID.h:21
armarx::skills::gui::SkillMap
std::map< skills::ProviderID, std::map< skills::SkillID, skills::SkillDescription > > SkillMap
Definition: SkillManagerWrapper.cpp:11
armarx::skills::gui::SkillTreeWidget
Definition: SkillTreeWidget.h:15
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
armarx::skills::gui::SkillTreeWidget::SkillTreeWidget
SkillTreeWidget(std::shared_ptr< SkillManagerWrapper > _memory, QWidget *parent=nullptr)
Definition: SkillTreeWidget.h:19
armarx::skills::gui::SkillTreeWidget::disconnectGui
void disconnectGui()
Definition: SkillTreeWidget.cpp:137
armarx::skills::gui::SkillTreeWidget::SelectedSkill::SelectedSkill
SelectedSkill()
Definition: SkillTreeWidget.h:30
armarx::skills::gui::SkillTreeWidget::updateGui
void updateGui(SkillMap update)
Definition: SkillTreeWidget.cpp:28
armarx::skills::SkillID
Definition: SkillID.h:17
armarx::skills::gui::SkillTreeWidget::SelectedSkill
Definition: SkillTreeWidget.h:25
armarx::skills::gui::MemoryCommunicatorBase
Definition: MemoryCommunicatorBase.h:14