Walls And Holes  1
propertybrowser.h
Go to the documentation of this file.
1 #ifndef PROPERTYBROWSER_H
2 #define PROPERTYBROWSER_H
3 
5 
6 #include <QMap>
7 #include <QScrollArea>
8 #include <QVBoxLayout>
9 #include <QHBoxLayout>
10 #include <QLabel>
11 
12 // TODO : Provide good full documentation about how to create a propertyManager
13 
17 class PropertyBrowser : public QScrollArea
18 {
19  Q_OBJECT
20 
21 public:
22  enum CustomType {
23  LineWidget, //A one line widget
24  BlockWidget, //A multi line widget which will apear bellow the label
25  PropertyManager //Another property manager, which will create a nested propertyBrowser (most fun)
26  };
27 
28  explicit PropertyBrowser(QWidget *parent = nullptr);
29 
37  void setPropertyManager(AbstractPropertyManager *propertyManager);
38 
44  void clear();
45 
46 private:
47  QWidget *mMainWidget;
48 
49  void makeLine(QString propertyName, QVariant value, bool editable, QVector<QVariant> extra);
50  void setLine(QString propertyName, QVariant value);
51  void blankLine(QString propertyName);
52 
53  AbstractPropertyManager *mPropertyManager;
54 
55  //A line will have two components, a Label and a widget
56  QMap<QString, QBoxLayout *> mLines;
57  QMap<QString, QMetaType::Type> mLineType;
58  QMap<QString, QWidget *> mLineWidget;
59  QMap<QString, QLabel *> mLineLabel;
60 
61  QVBoxLayout *mMainLayout;
62 };
63 
64 #endif // PROPERTYBROWSER_H
Definition: propertybrowser.h:25
The PropertyBrowser class.
Definition: propertybrowser.h:17
void setPropertyManager(AbstractPropertyManager *propertyManager)
setPropertyManager Takes ownership of the property manager. The old property manager will be deleted...
Definition: propertybrowser.cpp:23
void clear()
clear Deletes the current propertyManager if there is one. The PropertyBrowser will show nothing...
Definition: propertybrowser.cpp:51
PropertyBrowser(QWidget *parent=nullptr)
Definition: propertybrowser.cpp:12
CustomType
Definition: propertybrowser.h:22
Definition: propertybrowser.h:23
Definition: propertybrowser.h:24
The AbstractPropertyManager class Should take some source data in the constructor, and implement the ability to see and modify any properties of the core object.
Definition: abstractpropertymanager.h:13