33#include <NDEVR/QTDesignObject.h>
34#include <NDEVR/Toggle.h>
35#include <NDEVR/ManagedDesignCommand.h>
36#include <NDEVR/JSONNode.h>
51 setFunction([
this](
Button*)
63 setDesignProperty(property);
67 if (m_target ==
object)
69 if (!m_target.isNull())
71 disconnect(&m_target.get(), &QTDesignObject::updatedSignal,
this, &DesignObjectToggleWidget::onObjectUpdatedSlot);
72 disconnect(&m_target.get(), &QTDesignObject::deletedSignal,
this, &DesignObjectToggleWidget::onObjectDeletedSlot);
75 if (!m_target.isNull())
77 connect(&m_target.get(), &QTDesignObject::updatedSignal,
this, &DesignObjectToggleWidget::onObjectUpdatedSlot);
78 connect(&m_target.get(), &QTDesignObject::deletedSignal,
this, &DesignObjectToggleWidget::onObjectDeletedSlot);
80 setEnabled(!m_target.isNull());
81 onObjectUpdatedSlot();
85 m_property = property;
86 if (m_title.isEmpty())
88 if (property == DesignObject::DesignProperty::e_meta_data)
91 setTitle(String::DisplayString(property));
93 onObjectUpdatedSlot();
98 m_meta_data = meta_data;
99 setDesignProperty(DesignObject::DesignProperty::e_meta_data);
103 m_meta_data = metadata;
104 setDesignProperty(DesignObject::DesignProperty::e_meta_data);
113 bool toggle = isChecked();
114 if (m_property == DesignObject::DesignProperty::e_meta_data)
116 m_target->postCommand(ManagedDesignCommand::SetMetadata(m_meta_data,
String(toggle)));
121 m_target->postCommand(ManagedDesignCommand::SetProperty(m_property, toggle));
126 if (!m_target.isNull() && m_property != DesignObject::e_design_property_size)
128 bool checked =
false;
129 if (m_property == DesignObject::e_meta_data)
131 if (m_target->get().hasMetaData(m_meta_data))
132 checked = m_target->get().metaData(m_meta_data).getAs<
bool>();
136 checked = m_target->getProperty<
bool>(m_property);
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
Definition DesignObject.h:67
t_type getProperty(DesignProperty property) const
Definition DesignObject.h:256
DesignProperty
Values stored in the property database.
Definition DesignObject.h:93
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
The core String class for the NDEVR API.
Definition String.h:69
A Button that toggles between on and off. In desktop mode this looks like a checkbox and in touch mod...
Definition Toggle.h:49
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13