33#include <NDEVR/QTDesignObject.h>
34#include <NDEVR/Toggle.h>
35#include <NDEVR/ManagedDesignCommand.h>
36#include <NDEVR/JSONNode.h>
47 setFunction([
this](
Button*)
59 setDesignProperty(property);
63 if (m_target ==
object)
65 if (!m_target.isNull())
67 disconnect(&m_target.get(), &QTDesignObject::updatedSignal,
this, &DesignObjectToggleWidget::onObjectUpdatedSlot);
68 disconnect(&m_target.get(), &QTDesignObject::deletedSignal,
this, &DesignObjectToggleWidget::onObjectDeletedSlot);
71 if (!m_target.isNull())
73 connect(&m_target.get(), &QTDesignObject::updatedSignal,
this, &DesignObjectToggleWidget::onObjectUpdatedSlot);
74 connect(&m_target.get(), &QTDesignObject::deletedSignal,
this, &DesignObjectToggleWidget::onObjectDeletedSlot);
76 setEnabled(!m_target.isNull());
77 onObjectUpdatedSlot();
81 m_property = property;
82 if (m_title.isEmpty())
84 if (property == DesignObject::DesignProperty::e_meta_data)
87 setTitle(String::DisplayString(property));
89 onObjectUpdatedSlot();
94 m_meta_data = meta_data;
95 setDesignProperty(DesignObject::DesignProperty::e_meta_data);
99 m_meta_data = metadata;
100 setDesignProperty(DesignObject::DesignProperty::e_meta_data);
109 bool toggle = isChecked();
110 if (m_property == DesignObject::DesignProperty::e_meta_data)
112 m_target->postCommand(ManagedDesignCommand::SetMetadata(m_meta_data,
String(toggle)));
117 m_target->postCommand(ManagedDesignCommand::SetProperty(m_property, toggle));
122 if (!m_target.isNull() && m_property != DesignObject::e_design_property_size)
124 bool checked =
false;
125 if (m_property == DesignObject::e_meta_data)
127 if (m_target->get().hasMetaData(m_meta_data))
128 checked = m_target->get().metaData(m_meta_data).getAs<
bool>();
132 checked = m_target->getProperty<
bool>(m_property);
Definition DesignObject.h:66
t_type getProperty(DesignProperty property) const
Definition DesignObject.h:263
DesignProperty
Definition DesignObject.h:94
Definition Pointer.hpp:303
Definition TranslatedString.h:9