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"
15
16namespace 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
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
AronTreeWidgetController(QTreeWidget *tree, QTreeWidgetItem *parent, const aron::type::ObjectPtr &type, const aron::data::DictPtr &data=nullptr)
std::shared_ptr< Dict > DictPtr
Definition Dict.h:42
std::shared_ptr< Object > ObjectPtr
Definition Object.h:36
std::shared_ptr< AronTreeWidgetController > AronTreeWidgetControllerPtr