13 .type = ElementType::Nand,
14 .group = ElementGroup::Gate,
19 .canChangeAppearance =
true,
21 static_assert(
validate(constraints));
26 meta.pixmapPath = []{
return QStringLiteral(
":/Components/Logic/nand.svg"); };
27 meta.titleText = QT_TRANSLATE_NOOP(
"Nand",
"NAND");
28 meta.translatedName = QT_TRANSLATE_NOOP(
"Nand",
"Nand");
29 meta.trContext =
"Nand";
31 meta.defaultAppearances = QStringList({
":/Components/Logic/nand.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
Graphic element for the NAND gate.
Four-state logic operations for gate evaluation.
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 a NAND gate (2–8 inputs, 1 output).
void updateLogic() override
Sets output to the logical NAND of all inputs.
Nand(QGraphicsItem *parent=nullptr)
Constructs a Nand gate element with default 2 inputs.
Status statusAndAll(const QVector< Status > &inputs)
Fold AND over a range. Inactive dominates.
Status statusNot(const Status a)
NOT: inverts known values; Unknown -> Unknown, Error -> Error.
Compile-time-validatable subset of ElementMetadata.
static const bool registered
static constexpr ElementConstraints constraints
static ElementMetadata metadata()
Self-registering element information trait.