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
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
AronTreeWidgetItem.h
Data.h
ArmarXGuiPlugin.h
ArmarXComponentWidgetController.h
armarx::AronTreeWidgetController::setFromAron
void setFromAron(const aron::data::DictPtr &)
Definition: AronTreeWidgetController.cpp:71
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::AronTreeWidgetController::AronTreeWidgetController
AronTreeWidgetController(QTreeWidget *tree, QTreeWidgetItem *parent, const aron::type::ObjectPtr &type, const aron::data::DictPtr &data=nullptr)
Definition: AronTreeWidgetController.cpp:12
armarx::AronTreeWidgetController
Definition: AronTreeWidgetController.h:20
armarx::AronTreeWidgetController::convertToAron
aron::data::DictPtr convertToAron() const
Definition: AronTreeWidgetController.cpp:57
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::AronTreeWidgetController::ShowContextMenu
void ShowContextMenu(const QPoint &)
Definition: AronTreeWidgetController.cpp:80
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::AronTreeWidgetControllerPtr
std::shared_ptr< AronTreeWidgetController > AronTreeWidgetControllerPtr
Definition: AronTreeWidgetController.h:51
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h