Ocular Engine
PropertyWidget.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_EDITOR_PROPERTY_WIDGET__H__
19 #define __H__OCULAR_EDITOR_PROPERTY_WIDGET__H__
20 
21 #include <cstdint>
22 
23 #include <QtWidgets/qframe.h>
24 #include <QtWidgets/qboxlayout.h>
25 #include <QtWidgets/qlabel.h>
26 
27 #include "ObjectIO/ExposedVariable.hpp"
28 #include "Utilities/VoidCast.hpp"
29 
30 //------------------------------------------------------------------------------------------
31 
36 namespace Ocular
37 {
42  namespace Editor
43  {
51  class PropertyWidget : public QFrame
52  {
53  public:
54 
55  PropertyWidget(std::string const& type, QWidget* parent = nullptr);
56  ~PropertyWidget();
57 
58  virtual QSize sizeHint() const override;
59 
60  //------------------------------------------------------------
61 
68  virtual bool updateProperties();
69 
73  virtual void setValue(void* value, uint32_t size);
74 
78  virtual std::string getValue() const;
79 
83  std::string getType() const;
84 
91  void setVariable(Core::ExposedVariable& variable);
92 
98  void setDisplayName(std::string const& name);
99 
103  std::string const& getDisplayName() const;
104 
108  std::string const& getVariableName() const;
109 
115  void addWidgetLeftSide(QWidget* widget);
116 
122  void addWidgetRightSide(QWidget* widget);
123 
124  protected:
125 
126  QHBoxLayout* m_LayoutRight;
127 
129 
130  private:
131 
132  void createLeftSide();
133  void createRightSide();
134  void createLayout();
135 
136  //------------------------------------------------------------
137 
138  QFrame* m_FrameLeftSide;
139  QFrame* m_FrameRightSide;
140 
141  QHBoxLayout* m_Layout;
142  QHBoxLayout* m_LayoutLeft;
143 
144  QLabel* m_LabelName;
145 
146  std::string m_DisplayName;
147  std::string m_Type;
148  };
149  }
153 }
158 //------------------------------------------------------------------------------------------
159 
160 #endif
Parent class for all general property widgets.
Definition: PropertyWidget.hpp:51
virtual void setValue(void *value, uint32_t size)
Definition: PropertyWidget.cpp:61
virtual bool updateProperties()
Definition: PropertyWidget.cpp:56
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
std::string const & getVariableName() const
Definition: PropertyWidget.cpp:92
Core::ExposedVariable m_Variable
The variable this widget is responsible for displaying and modifying.
Definition: PropertyWidget.hpp:128
std::string getType() const
Definition: PropertyWidget.cpp:71
void setVariable(Core::ExposedVariable &variable)
Definition: PropertyWidget.cpp:76
void addWidgetLeftSide(QWidget *widget)
Definition: PropertyWidget.cpp:97
virtual std::string getValue() const
Definition: PropertyWidget.cpp:66
std::string const & getDisplayName() const
Definition: PropertyWidget.cpp:87
void setDisplayName(std::string const &name)
Definition: PropertyWidget.cpp:81
Definition: ExposedVariable.hpp:44
QHBoxLayout * m_LayoutRight
Layout for the right-side frame.
Definition: PropertyWidget.hpp:126
void addWidgetRightSide(QWidget *widget)
Definition: PropertyWidget.cpp:102