OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PropertyGrid.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
12
13// Qt header
14#include <QtWidgets/qwidget.h>
15
16// std header
17#include <list>
18
19class QTreeWidgetItem;
20
21namespace ot {
22
23 class Property;
24 class TreeWidget;
25 class PropertyGridItem;
26 class PropertyGridGroup;
27
28 class OT_WIDGETS_API_EXPORT PropertyGrid : public QObject, public QWidgetInterface {
29 Q_OBJECT
31 public:
32 PropertyGrid(QObject* _parentObject = (QObject*)nullptr);
33 virtual ~PropertyGrid();
34
35 // ###########################################################################################################################################################################################################################################################################################################################
36
37 // Base class functions
38
39 virtual QWidget* getQWidget(void) override;
40
41 // ###########################################################################################################################################################################################################################################################################################################################
42
43 // Setter / Getter
44
45 TreeWidget* getTreeWidget(void) const;
46
47 void setupGridFromConfig(const PropertyGridCfg& _config);
48 void addGroup(PropertyGridGroup* _group);
49
50 PropertyGridGroup* findGroup(const std::string& _groupName) const;
51 PropertyGridGroup* findGroup(const std::list<std::string>& _groupPath) const;
52 PropertyGridItem* findItem(const std::string& _groupName, const std::string& _itemName) const;
53 PropertyGridItem* findItem(const std::list<std::string>& _groupPath, const std::string& _itemName) const;
54
55 void clear(void);
56
57 void focusProperty(const std::string& _groupName, const std::string& _itemName);
58 void focusProperty(const std::list<std::string>& _groupPath, const std::string& _itemName);
59
60 Q_SIGNALS:
61 void propertyChanged(const Property* const _property);
62 void propertyDeleteRequested(const Property* const _property);
63
64 private Q_SLOTS:
65 void slotPropertyChanged(const Property* const _property);
66 void slotPropertyDeleteRequested(const Property* const _property);
67 void slotItemCollapsed(QTreeWidgetItem* _item);
68 void slotItemExpanded(QTreeWidgetItem* _item);
69
70 private:
71 PropertyGridGroup* findGroup(QTreeWidgetItem* _parentTreeItem, const std::list<std::string>& _groupPath) const;
72
73 class PropertyGridTree;
74 PropertyGridTree* m_tree;
75 };
76
77}
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_WIDGETS_API_EXPORT
Definition OTWidgetsAPIExport.h:12
Definition PropertyGrid.cpp:19
Definition PropertyGridCfg.h:21
Definition PropertyGridGroup.h:25
Definition PropertyGrid.h:28
Definition PropertyGridItem.h:31
The Property class is used as a base class for all Properties that can be displayed and modified in t...
Definition Property.h:21
Definition QWidgetInterface.h:18
Definition TreeWidget.h:23
Definition Connector.h:8