$ show qelectrotech/qelectrotech-source-mirror
QElectroTech is a mature, open-source desktop CAD application for creating electrical schematics and diagrams. Built on Qt (C++) with a rich graphics view framework, it provides full interactive editing for folios, conductors, terminals, element symbols, title blocks, and terminal strips. The system manages project files via XML, supports auto-numbering of elements and conductors, cross-referencing, bill-of-materials export, and imports EPLAN EDZ archives using bundled LZMA decompression. It is purely a desktop application with no server or data-pipeline components, offering a comprehensive set of features for electrical documentation in industrial and domestic contexts. The architecture follows a monolithic desktop GUI pattern with extensive use of Qt's model/view and graphics view frameworks. Key entry points include the main window (QETMainWindow), diagram editor (QETDiagramEditor), element editor, and terminal strip editor. The codebase demonstrates strong use of the undo/redo command pattern (QUndoCommand), a generic QPropertyUndoCommand, and a custom DXF paint engine. The project has a large number of interdependent modules but maintains reasonable separation through abstract base classes (PropertiesInterface, DiagramEventInterface). The code is professionally written with moderate complexity and a clear focus on functional CAD features rather than framework novelty.
The LLM identified 5 files worth highlighting for reuse:
Implements a generic QUndoCommand that stores previous and current QVariants for any QObject property. Supports merging with animationβcommands for consecutive property changes can be merged into one. This component is fully self-contained and can be reused in any Qt-based application needing undoable property editing without per-property command classes.
Provides a custom QPaintDevice and QPaintEngine that translate QPainter draw calls into DXF entities (LINE, LWPOLYLINE, TEXT, etc.). It replays paint() commands from any QGraphicsItem to generate a plain DXF file. This component is independent of the rest of the application and can be extracted for any Qt project needing DXF output.
A lock-free, fixed-capacity ring buffer for log messages, designed to be signal-safe for crash dump. Uses atomic operations to avoid locks, making it suitable for high-performance or safety-critical logging. The implementation is small, header-like, and can be reused in any C++ project needing a non-blocking ring buffer.
Installs POSIX signal handlers for fatal signals (SIGSEGV, SIGABRT, etc.) and dumps the last N log lines from the LogRing to a file. Uses preallocated buffers to avoid allocation in signal context. This pattern is self-contained and reusable in any application requiring robust crash diagnostics.
Abstract base class defining an interface for drawing terminal strips. Implementations (DemoTerminalStrip, TrueTerminalStrip) handle different rendering scenarios. This clean separation allows extendable drawing without modifying the core terminal strip logic. The pattern is reusable for any project needing pluggable rendering backends.