|
wiRedPanda
Logic Circuit Simulator
|
Item delegate that draws digital waveform graphics inside table cells. More...
#include <SignalDelegate.h>
Public Member Functions | |
| void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| PlotType | plotType () const |
| Returns the current cell rendering mode. | |
| void | setPlotType (PlotType plotType) |
| Selects the cell rendering mode (waveform graphics vs. numeric text). | |
| SignalDelegate (QObject *parent=nullptr) | |
| Constructs the delegate. | |
Static Public Member Functions | |
| static WaveSegment | segmentFor (int value, bool hasPrev, int prevValue) |
| Returns the waveform segment a cell should draw. | |
Item delegate that draws digital waveform graphics inside table cells.
Replaces the default text rendering with vector waveforms representing logic-high, logic-low, rising-edge, and falling-edge states, painted directly with QPainter at the cell's real size. Everything is derived at paint time from the SignalModel: the WaveSegment from the cell value and its left neighbour, and the input/output colour from SignalModel::isInputRow(). Nothing is stored per cell.
In Number mode (see setPlotType()) the delegate falls back to centered QItemDelegate text rendering.
Definition at line 41 of file SignalDelegate.h.
|
explicit |
Constructs the delegate.
Definition at line 26 of file SignalDelegate.cpp.
|
override |
Definition at line 74 of file SignalDelegate.cpp.
References Number, and segmentFor().
|
inline |
Returns the current cell rendering mode.
Definition at line 53 of file SignalDelegate.h.
Referenced by setPlotType().
|
static |
Returns the waveform segment a cell should draw.
| value | Current cell value (0 or 1). |
| hasPrev | true if a cell exists to the left of this one. |
| prevValue | Value of the previous cell (only meaningful when hasPrev is true). |
Definition at line 36 of file SignalDelegate.cpp.
References Falling, High, Low, and Rising.
Referenced by paint().
| void SignalDelegate::setPlotType | ( | PlotType | plotType | ) |
Selects the cell rendering mode (waveform graphics vs. numeric text).
Definition at line 31 of file SignalDelegate.cpp.
References plotType().