OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PropertyInput.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/JSON.h"
10#include "OTGui/PropertyBase.h"
13
14// Qt header
15#include <QtCore/qobject.h>
16#include <QtCore/qvariant.h>
17
18namespace ot {
19
20 class Property;
21 class PropertyGridItem;
22
23 class OT_WIDGETS_API_EXPORT PropertyInput : public QObject, public QWidgetInterface {
24 Q_OBJECT
26 public:
28 virtual ~PropertyInput() {};
29
34 virtual void addPropertyInputValueToJson(ot::JsonValue& _object, const char* _memberNameValue, ot::JsonAllocator& _allocator) = 0;
35
37 virtual QVariant getCurrentValue(void) const = 0;
38
40 virtual Property* createPropertyConfiguration(void) const = 0;
41
43 virtual QWidget* getQWidget(void) override = 0;
44 virtual const QWidget* getQWidget(void) const override = 0;
45
47 virtual bool setupFromConfiguration(const Property* _configuration);
48
50 virtual void focusPropertyInput(void) = 0;
51
52 const std::string& getPropertyType(void) const { return m_type; };
53
54 void setData(const PropertyBase& _data) { m_data = _data; };
55 PropertyBase& data(void) { return m_data; };
56 const PropertyBase& data(void) const { return m_data; };
57
58 void setDataHasChanged(bool _changed = true) { m_dataChanged = _changed; };
59 bool dataHasChanged(void) const { return m_dataChanged; };
60
61 Q_SIGNALS:
64
65 public Q_SLOTS:
67 void slotValueChanged(void);
68
70 void slotValueChanged(bool);
71
73 void slotValueChanged(int);
74
75 private Q_SLOTS:
76 void slotEmitValueChanged(void);
77
78 private:
79 std::string m_type;
80 PropertyBase m_data;
81 bool m_dataChanged;
82 };
83}
#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
The PropertyBase class is used to hold general Property information.
Definition PropertyBase.h:25
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 PropertyInput.h:23
virtual QWidget * getQWidget(void) override=0
Returns the root widget of the input (allows nested widgets)
virtual ~PropertyInput()
Definition PropertyInput.h:28
PropertyBase & data(void)
Definition PropertyInput.h:55
virtual const QWidget * getQWidget(void) const override=0
const PropertyBase & data(void) const
Definition PropertyInput.h:56
void setDataHasChanged(bool _changed=true)
Definition PropertyInput.h:58
virtual void focusPropertyInput(void)=0
Sets the focus on the input widget.
void inputValueChanged(void)
Is emitted whenever the user changed a value.
const std::string & getPropertyType(void) const
Definition PropertyInput.h:52
virtual Property * createPropertyConfiguration(void) const =0
Creates a property configuration that can be used to later create this object.
bool dataHasChanged(void) const
Definition PropertyInput.h:59
virtual QVariant getCurrentValue(void) const =0
Returns the current value.
virtual void addPropertyInputValueToJson(ot::JsonValue &_object, const char *_memberNameValue, ot::JsonAllocator &_allocator)=0
Add the current value to the provided JSON object.
void setData(const PropertyBase &_data)
Definition PropertyInput.h:54
Definition QWidgetInterface.h:18
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30