13 .type = ElementType::Xor,
14 .group = ElementGroup::Gate,
19 .canChangeAppearance =
true,
21 static_assert(
validate(constraints));
26 meta.pixmapPath = []{
return QStringLiteral(
":/Components/Logic/xor.svg"); };
27 meta.titleText = QT_TRANSLATE_NOOP(
"Xor",
"XOR");
28 meta.translatedName = QT_TRANSLATE_NOOP(
"Xor",
"Xor");
29 meta.trContext =
"Xor";
31 meta.defaultAppearances = QStringList({
":/Components/Logic/xor.svg"});
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
Four-state logic operations for gate evaluation.
Graphic element for the XOR gate.
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< Status > & simInputs() const
Read-only view of the cached simulation input values.
bool simUpdateInputsAllowUnknown()
Like simUpdateInputs(), but allows Unknown/Error values through.
void setOutputValue(const int index, const Status value)
Sets simulation output port index to value.
Graphical representation of an XOR gate (2–8 inputs, 1 output).
void updateLogic() override
Sets output to the logical XOR of all inputs.
Xor(QGraphicsItem *parent=nullptr)
Constructs an Xor gate element with default 2 inputs.
Status statusXorAll(const QVector< Status > &inputs)
Compile-time-validatable subset of ElementMetadata.
static constexpr ElementConstraints constraints
static ElementMetadata metadata()
static const bool registered
Self-registering element information trait.