13 .type = ElementType::InputGnd,
14 .group = ElementGroup::StaticInput,
17 .canChangeAppearance =
true,
20 .rotatesGraphic =
false,
22 static_assert(
validate(constraints));
27 meta.pixmapPath = []{
return QStringLiteral(
":/Components/Input/0.svg"); };
28 meta.titleText = QT_TRANSLATE_NOOP(
"InputGnd",
"GROUND");
29 meta.translatedName = QT_TRANSLATE_NOOP(
"InputGnd",
"GND");
30 meta.trContext =
"InputGnd";
32 meta.defaultAppearances = QStringList({
":/Components/Input/0.svg"});
48 outputs().constFirst()->setDefaultStatus(Status::Inactive);
Singleton factory for all circuit element types.
Self-registering element trait template and compile-time constraint validation.
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.
Enums::ElementType ElementType
Port classes: Port (base), InputPort, and OutputPort.
static void registerCreator(ElementType type, std::function< GraphicElement *()> creator)
Registers a creator lambda for type, used by buildElement().
GraphicElement(ElementType type, QGraphicsItem *parent=nullptr)
Constructs a graphic element of the given type, fetching all properties from the metadata registry.
const QVector< OutputPort * > & outputs() const
Returns a const reference to the vector of all output ports.
Compile-time-validatable subset of ElementMetadata.
Self-registering element information trait.