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

Functions

void addItems (Scene *scene, const QList< QGraphicsItem * > &items)
void deleteItems (Scene *scene, const QList< QGraphicsItem * > &items)
void drainPortConnections (GraphicElement *elm, int fromPort, int toPort, bool isInput, QDataStream &stream, Scene *scene)
 Saves and deletes connections on ports in range [fromPort, toPort).
ConnectionfindConn (Scene *scene, const int id)
const QList< GraphicElement * > findElements (Scene *scene, const QList< int > &ids)
GraphicElementfindElm (Scene *scene, const int id)
const QList< QGraphicsItem * > findItems (Scene *scene, const QList< int > &ids)
const QList< QGraphicsItem * > loadItems (Scene *scene, QByteArray &itemData, const QList< int > &ids, QList< int > &otherIds)
const QList< QGraphicsItem * > loadList (const QList< QGraphicsItem * > &items, QList< int > &ids, QList< int > &otherIds)
void saveItems (Scene *scene, QByteArray &itemData, const QList< QGraphicsItem * > &items, const QList< int > &otherIds)
void storeIds (const QList< QGraphicsItem * > &items, QList< int > &ids)
void storeOtherIds (const QList< QGraphicsItem * > &connections, const QList< int > &ids, QList< int > &otherIds)

Function Documentation

◆ addItems()

void CommandUtils::addItems ( Scene * scene,
const QList< QGraphicsItem * > & items )

Definition at line 172 of file Commands.cpp.

References Scene::addItem(), and GraphicElement::Type.

Referenced by AddItemsCommand::AddItemsCommand(), and loadItems().

◆ deleteItems()

void CommandUtils::deleteItems ( Scene * scene,
const QList< QGraphicsItem * > & items )

Definition at line 220 of file Commands.cpp.

References Scene::removeItem().

Referenced by DeleteItemsCommand::redo(), and AddItemsCommand::undo().

◆ drainPortConnections()

void CommandUtils::drainPortConnections ( GraphicElement * elm,
int fromPort,
int toPort,
bool isInput,
QDataStream & stream,
Scene * scene )

Saves and deletes connections on ports in range [fromPort, toPort).

Definition at line 229 of file Commands.cpp.

References Port::connections(), GraphicElement::inputPort(), GraphicElement::outputPort(), and Scene::removeItem().

Referenced by ChangePortSizeCommand::redo().

◆ findConn()

Connection * CommandUtils::findConn ( Scene * scene,
const int id )

Definition at line 147 of file Commands.cpp.

References Scene::itemById().

Referenced by SplitCommand::redo(), and SplitCommand::undo().

◆ findElements()

const QList< GraphicElement * > CommandUtils::findElements ( Scene * scene,
const QList< int > & ids )

◆ findElm()

GraphicElement * CommandUtils::findElm ( Scene * scene,
const int id )

◆ findItems()

const QList< QGraphicsItem * > CommandUtils::findItems ( Scene * scene,
const QList< int > & ids )

Definition at line 111 of file Commands.cpp.

References Scene::itemById(), and PANDACEPTION_WITH_CONTEXT.

Referenced by DeleteItemsCommand::redo(), and AddItemsCommand::undo().

◆ loadItems()

const QList< QGraphicsItem * > CommandUtils::loadItems ( Scene * scene,
QByteArray & itemData,
const QList< int > & ids,
QList< int > & otherIds )

◆ loadList()

const QList< QGraphicsItem * > CommandUtils::loadList ( const QList< QGraphicsItem * > & items,
QList< int > & ids,
QList< int > & otherIds )

◆ saveItems()

void CommandUtils::saveItems ( Scene * scene,
QByteArray & itemData,
const QList< QGraphicsItem * > & items,
const QList< int > & otherIds )

◆ storeIds()

void CommandUtils::storeIds ( const QList< QGraphicsItem * > & items,
QList< int > & ids )

Definition at line 28 of file Commands.cpp.

Referenced by loadList().

◆ storeOtherIds()

void CommandUtils::storeOtherIds ( const QList< QGraphicsItem * > & connections,
const QList< int > & ids,
QList< int > & otherIds )

Definition at line 39 of file Commands.cpp.

Referenced by loadList().