|
wiRedPanda
Logic Circuit Simulator
|
Factory for circuit elements. More...
#include <ElementFactory.h>
Static Public Member Functions | |
| static GraphicElement * | buildElement (const ElementType type) |
| Constructs and returns a new graphic element of the given type. | |
| static QString | description (const ElementType type) |
| static bool | hasCreator (ElementType type) |
Returns true if a creator function is registered for type. | |
| static ElementFactory & | instance () |
| Returns the singleton ElementFactory instance. | |
| static QPixmap | pixmap (const ElementType type) |
| Returns the pixmap icon for the given element type. | |
| static void | registerCreator (ElementType type, std::function< GraphicElement *()> creator) |
| Registers a creator lambda for type, used by buildElement(). | |
| static ElementType | textToType (const QString &text) |
| Converts an element type name string to its ElementType enum value. | |
| static QString | translatedName (const ElementType type) |
| Returns the translated human-readable name for type. | |
| static QString | typeToText (const ElementType type) |
| Converts type to its internal name string. | |
| static QString | typeToTitleText (const ElementType type) |
| Returns the display title string for type. | |
Factory for circuit elements.
The ElementFactory class is a singleton that handles the creation of circuit elements and provides access to element type properties. ID management is handled by Scene, not by this class.
Definition at line 26 of file ElementFactory.h.
|
static |
Constructs and returns a new graphic element of the given type.
Definition at line 104 of file ElementFactory.cpp.
References instance(), PANDACEPTION, qCDebug, and typeToText().
Referenced by SceneDropHandler::addFromMimeData(), Serialization::deserialize(), SceneDropHandler::handleNewElementDrop(), MorphCommand::redo(), SplitCommand::redo(), SplitCommand::SplitCommand(), and MorphCommand::undo().
|
static |
Returns a short, translated functional description of type for palette tooltips (empty for types without one, e.g. IC).
Definition at line 58 of file ElementFactory.cpp.
Referenced by ElementLabel::ElementLabel().
|
static |
Returns true if a creator function is registered for type.
Definition at line 126 of file ElementFactory.cpp.
References instance().
|
inlinestatic |
Returns the singleton ElementFactory instance.
Definition at line 32 of file ElementFactory.h.
References instance().
Referenced by buildElement(), hasCreator(), instance(), and registerCreator().
|
static |
Returns the pixmap icon for the given element type.
Definition at line 95 of file ElementFactory.cpp.
References ElementMetadataRegistry::metadata(), and ElementMetadata::pixmapPath.
Referenced by addElementAction(), ElementContextMenu::exec(), MainWindow::populateMenu(), and ElementLabel::updateTheme().
|
static |
Registers a creator lambda for type, used by buildElement().
Definition at line 121 of file ElementFactory.cpp.
References instance().
|
static |
Converts an element type name string to its ElementType enum value.
Definition at line 13 of file ElementFactory.cpp.
References qCDebug.
Referenced by MainWindow::populateMenu().
|
static |
Returns the translated human-readable name for type.
Definition at line 48 of file ElementFactory.cpp.
References ElementMetadataRegistry::metadata().
Referenced by addElementAction(), ElementLabel::ElementLabel(), GraphicElement::retranslate(), and ElementLabel::updateName().
|
static |
Converts type to its internal name string.
Definition at line 24 of file ElementFactory.cpp.
References qCDebug.
Referenced by buildElement().
|
static |
Returns the display title string for type.
Definition at line 36 of file ElementFactory.cpp.
References ElementMetadataRegistry::metadata(), and qCDebug.