template<typename T>
struct ElementInfo< T >
Self-registering element information trait.
Specializations must define:
The registered initializer performs both metadata and factory registration.
Example:
template<>
.type = ElementType::And,
.group = ElementGroup::Gate,
.minInputSize = 2, .maxInputSize = 8,
.minOutputSize = 1, .maxOutputSize = 1,
.canChangeAppearance = true,
};
meta.pixmapPath = []{ return QStringLiteral(":/path.svg"); };
meta.titleText = QT_TRANSLATE_NOOP("And", "AND");
meta.translatedName = QT_TRANSLATE_NOOP("And", "And");
meta.trContext = "And";
meta.defaultAppearances = {":/path.svg"};
return meta;
}
static inline const bool registered = []() {
return true;
}();
};
ElementMetadata metadataFromConstraints(const ElementConstraints &c)
Converts ElementConstraints to an ElementMetadata with all constraint-derived fields set.
constexpr bool validate(const ElementConstraints &c)
Validates element constraints at compile time.
Graphical representation of an AND gate (2–8 inputs, 1 output).
static void registerCreator(ElementType type, std::function< GraphicElement *()> creator)
Registers a creator lambda for type, used by buildElement().
Compile-time-validatable subset of ElementMetadata.
Self-registering element information trait.
Definition at line 145 of file ElementInfo.h.