AronTreeWidgetController.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stack>
4 
5 #include <QTreeWidget>
6 
8 
11 
12 #include "AronTreeWidgetItem.h"
13 #include "Data.h"
14 #include "visitors/AronTreeWidgetCreator.h"
15 
16 namespace armarx::skills::gui
17 {
18  // Main controller for any AronTreeWidget GUI. It attaches itself to the parent and needs the active widget.
19  // It's responsible to handle all signals for non-widget fields and click events.
20  class AronTreeWidgetController : public QObject
21  {
22  Q_OBJECT
23  public:
24  AronTreeWidgetController(QTreeWidget* tree,
25  QTreeWidgetItem* parent,
26  const aron::type::ObjectPtr& type,
27  const aron::data::DictPtr& data = nullptr);
28 
30  void setFromAron(const aron::data::DictPtr&);
31 
32  private:
33  QTreeWidgetItem* parent;
34  QTreeWidget* tree;
35 
37 
38  private slots:
39  // allows most primitive fields to be directly editable in the tree
40  // only String will open up a new widget
41  void onTreeWidgetItemDoubleClicked(QTreeWidgetItem* item, int column);
42  // check the new user input. Maybe undo if the field must not be edited.
43  // Also highlight if the input cannot be parsed. (Or the errors are now fixed)
44  void onTreeWidgetItemChanged(QTreeWidgetItem* item, int column);
45 
46  public slots:
47  // hook for items to show a context menu (add / delete element)
48  void ShowContextMenu(const QPoint&);
49  };
50 
51  using AronTreeWidgetControllerPtr = std::shared_ptr<AronTreeWidgetController>;
52 } // namespace armarx::skills::gui
armarx::skills::gui::AronTreeWidgetController::convertToAron
aron::data::DictPtr convertToAron() const
Definition: AronTreeWidgetController.cpp:56
armarx::skills::gui::AronTreeWidgetController
Definition: AronTreeWidgetController.h:20
armarx::skills::gui::AronTreeWidgetController::setFromAron
void setFromAron(const aron::data::DictPtr &)
Definition: AronTreeWidgetController.cpp:70
armarx::skills::gui::AronTreeWidgetController::AronTreeWidgetController
AronTreeWidgetController(QTreeWidget *tree, QTreeWidgetItem *parent, const aron::type::ObjectPtr &type, const aron::data::DictPtr &data=nullptr)
Definition: AronTreeWidgetController.cpp:11
armarx::skills::gui::AronTreeWidgetControllerPtr
std::shared_ptr< AronTreeWidgetController > AronTreeWidgetControllerPtr
Definition: AronTreeWidgetController.h:51
ArmarXGuiPlugin.h
ArmarXComponentWidgetController.h
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
Data.h
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
AronTreeWidgetItem.h
armarx::skills::gui::AronTreeWidgetController::ShowContextMenu
void ShowContextMenu(const QPoint &)
Definition: AronTreeWidgetController.cpp:80
ImportExportComponent.h