wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
DolphinClipboard Namespace Reference

The beWavedDolphin clipboard layer: cell ↔ stream mapping plus the system clipboard transport (MIME wrapping and the versioned data header). More...

Functions

void copy (const SignalModel &model, const QItemSelection &ranges, QDataStream &stream)
void copyToClipboard (const SignalModel &model, const QItemSelection &ranges)
int firstColumn (const SignalModel &model, const QItemSelection &ranges)
 Returns the leftmost column index in ranges (clamped to the model's columns).
int firstRow (const SignalModel &model, const QItemSelection &ranges)
 Returns the topmost row index in ranges (clamped to the model's rows).
void paste (SignalModel &model, const QItemSelection &ranges, QDataStream &stream)
bool pasteFromClipboard (SignalModel &model, const QItemSelection &ranges)

Detailed Description

The beWavedDolphin clipboard layer: cell ↔ stream mapping plus the system clipboard transport (MIME wrapping and the versioned data header).

copy()/paste() are the pure data mapping between a SignalModel and a QDataStream (no simulation — the controller's slots own that). copyToClipboard()/ pasteFromClipboard() add the transport: the application MIME type, the legacy MIME type accepted on paste, and the versioned Serialization header. Cell values are stored relative to the selection's top-left so they can be re-anchored on paste.

Function Documentation

◆ copy()

void DolphinClipboard::copy ( const SignalModel & model,
const QItemSelection & ranges,
QDataStream & stream )

Serializes the values of the cells in ranges to stream (offsets relative to the selection's top-left).

Definition at line 48 of file DolphinClipboard.cpp.

References firstColumn(), firstRow(), and SignalModel::value().

Referenced by copyToClipboard().

◆ copyToClipboard()

void DolphinClipboard::copyToClipboard ( const SignalModel & model,
const QItemSelection & ranges )

Serializes the cells in ranges (with the versioned header) and places them on the system clipboard under the beWavedDolphin MIME type. ranges must be non-empty.

Definition at line 102 of file DolphinClipboard.cpp.

References copy(), and Serialization::writeDolphinHeader().

◆ firstColumn()

int DolphinClipboard::firstColumn ( const SignalModel & model,
const QItemSelection & ranges )

Returns the leftmost column index in ranges (clamped to the model's columns).

Definition at line 38 of file DolphinClipboard.cpp.

Referenced by copy(), and paste().

◆ firstRow()

int DolphinClipboard::firstRow ( const SignalModel & model,
const QItemSelection & ranges )

Returns the topmost row index in ranges (clamped to the model's rows).

Definition at line 43 of file DolphinClipboard.cpp.

Referenced by copy(), and paste().

◆ paste()

void DolphinClipboard::paste ( SignalModel & model,
const QItemSelection & ranges,
QDataStream & stream )

Deserializes cells from stream into model, anchored at the top-left of ranges. Cells landing outside the input rows or past the last column are silently dropped.

Definition at line 66 of file DolphinClipboard.cpp.

References firstColumn(), firstRow(), SignalModel::inputRows(), and SignalModel::setValue().

Referenced by pasteFromClipboard().

◆ pasteFromClipboard()

bool DolphinClipboard::pasteFromClipboard ( SignalModel & model,
const QItemSelection & ranges )

Reads beWavedDolphin waveform data from the system clipboard (current or legacy MIME type) and pastes it into model anchored at the top-left of ranges. Returns true iff the clipboard held waveform data that was applied.

Definition at line 115 of file DolphinClipboard.cpp.

References paste(), and Serialization::readDolphinHeader().