33#include <NDEVR/QTDesignObject.h>
34#include <NDEVR/QCustomCombobox.h>
35#include <NDEVR/QCustomValidator.h>
36#include <NDEVR/ManagedDesignCommand.h>
37#include <NDEVR/JSONNode.h>
38#include <NDEVR/RegexFunctions.h>
49 connect(
this, &QCustomComboBox::edited,
this, &DesignObjectComboWidget::sendCommand);
58 setDesignProperty(property);
62 if (m_target ==
object)
64 if (!m_target.isNull())
66 disconnect(&m_target.get(), &QTDesignObject::updatedSignal,
this, &DesignObjectComboWidget::onObjectUpdatedSlot);
67 disconnect(&m_target.get(), &QTDesignObject::deletedSignal,
this, &DesignObjectComboWidget::onObjectDeletedSlot);
70 if (!m_target.isNull())
72 connect(&m_target.get(), &QTDesignObject::updatedSignal,
this, &DesignObjectComboWidget::onObjectUpdatedSlot);
73 connect(&m_target.get(), &QTDesignObject::deletedSignal,
this, &DesignObjectComboWidget::onObjectDeletedSlot);
75 setEnabled(!m_target.isNull());
76 onObjectUpdatedSlot();
80 m_property = property;
81 if (m_title.translation().size() == 0)
83 if (property == DesignObject::DesignProperty::e_meta_data)
84 setWindowTitle(m_meta_data_title.formatTitleString().getAs<QString>());
86 setWindowTitle(
String(property).formatTitleString().getAs<QString>());
89 onObjectUpdatedSlot();
92 case DesignObject::DesignProperty::e_file:
93 validator.
setRegex(RegexFunctions::FileRegex());
99 setCustomValidator(validator);
103 m_meta_data_title = metadata;
104 setDesignProperty(DesignObject::DesignProperty::e_meta_data);
109 if (m_title.translation().size() == 0)
111 if (m_property == DesignObject::DesignProperty::e_meta_data)
112 setWindowTitle(m_meta_data_title.formatTitleString().getAs<QString>());
114 setWindowTitle(
String(m_property).formatTitleString().getAs<QString>());
118 setWindowTitle(m_title.translation().getAs<QString>());
128 if (m_target.isNull())
130 String name = getAs<String>();
131 if (m_property == DesignObject::DesignProperty::e_meta_data)
133 m_target->postCommand(ManagedDesignCommand::SetMetadata(m_meta_data_title, name));
138 m_target->postCommand(ManagedDesignCommand::SetProperty(m_property, name));
143 if (!m_target.isNull() && m_property != DesignObject::e_design_property_size)
146 if (m_property == DesignObject::e_meta_data)
148 if (m_target->get().hasMetaData(m_meta_data_title))
149 object_name = m_target->
get().metaData(m_meta_data_title).getAs<
String>();
153 object_name = m_target->getProperty<
String>(m_property);
155 if (object_name.
size() != 0)
157 setValue(object_name);
constexpr t_index_type size() const
Definition Buffer.hpp:1461
decltype(auto) get(t_index_type index)
Definition Buffer.hpp:857
Definition DesignObject.h:66
t_type getProperty(DesignProperty property) const
Definition DesignObject.h:263
DesignProperty
Definition DesignObject.h:94
Definition Pointer.hpp:303
Definition QCustomCombobox.h:47
Definition QCustomValidator.h:43
void setRegex(const String ®ex)
Definition QCustomValidator.cpp:296
t_type getAs() const
Definition String.h:334
Definition TranslatedString.h:9