![]() |
HAL
|
Abstract base class for nodes (e.g. gates, modules) More...
#include <graphics_node.h>
Classes | |
struct | Visuals |
Public Member Functions | |
GraphicsNode (const ItemType type, const u32 id, const QString &name) | |
virtual QRectF | boundingRect () const override |
virtual QPainterPath | shape () const override |
virtual QPointF | getInputScenePosition (const u32 mNetId, const QString &pin_type) const =0 |
virtual QPointF | getOutputScenePosition (const u32 mNetId, const QString &pin_type) const =0 |
virtual QPointF | endpointPositionByIndex (int index, bool isInput) const =0 |
virtual float | yEndpointDistance () const =0 |
virtual float | yTopPinDistance () const =0 |
int | inputByNet (u32 netId) const |
int | outputByNet (u32 netId) const |
QList< u32 > | inputNets () const |
QList< u32 > | outputNets () const |
virtual void | setVisuals (const Visuals &v) |
qreal | width () const |
qreal | height () const |
void | set_name (const QString &name) |
![]() | |
GraphicsItem (const ItemType type, const u32 id) | |
ItemType | itemType () const |
u32 | id () const |
void | setHightlight (bool hl) |
![]() | |
QGraphicsItem (QGraphicsItem *parent) | |
virtual | ~QGraphicsItem () |
QGraphicsScene * | scene () const const |
QGraphicsItem * | parentItem () const const |
QGraphicsItem * | topLevelItem () const const |
QGraphicsObject * | parentObject () const const |
QGraphicsWidget * | parentWidget () const const |
QGraphicsWidget * | topLevelWidget () const const |
QGraphicsWidget * | window () const const |
QGraphicsItem * | panel () const const |
void | setParentItem (QGraphicsItem *newParent) |
QList< QGraphicsItem * > | children () const const |
QList< QGraphicsItem * > | childItems () const const |
bool | isWidget () const const |
bool | isWindow () const const |
bool | isPanel () const const |
QGraphicsObject * | toGraphicsObject () |
const QGraphicsObject * | toGraphicsObject () const const |
QGraphicsItemGroup * | group () const const |
void | setGroup (QGraphicsItemGroup *group) |
QGraphicsItem::GraphicsItemFlags | flags () const const |
void | setFlag (QGraphicsItem::GraphicsItemFlag flag, bool enabled) |
void | setFlags (QGraphicsItem::GraphicsItemFlags flags) |
QGraphicsItem::CacheMode | cacheMode () const const |
void | setCacheMode (QGraphicsItem::CacheMode mode, const QSize &logicalCacheSize) |
QGraphicsItem::PanelModality | panelModality () const const |
void | setPanelModality (QGraphicsItem::PanelModality panelModality) |
bool | isBlockedByModalPanel (QGraphicsItem **blockingPanel) const const |
QString | toolTip () const const |
void | setToolTip (const QString &toolTip) |
QCursor | cursor () const const |
void | setCursor (const QCursor &cursor) |
bool | hasCursor () const const |
void | unsetCursor () |
bool | isVisible () const const |
bool | isVisibleTo (const QGraphicsItem *parent) const const |
void | setVisible (bool visible) |
void | hide () |
void | show () |
bool | isEnabled () const const |
void | setEnabled (bool enabled) |
bool | isSelected () const const |
void | setSelected (bool selected) |
bool | acceptDrops () const const |
void | setAcceptDrops (bool on) |
qreal | opacity () const const |
qreal | effectiveOpacity () const const |
void | setOpacity (qreal opacity) |
QGraphicsEffect * | graphicsEffect () const const |
void | setGraphicsEffect (QGraphicsEffect *effect) |
Qt::MouseButtons | acceptedMouseButtons () const const |
void | setAcceptedMouseButtons (Qt::MouseButtons buttons) |
bool | acceptsHoverEvents () const const |
void | setAcceptsHoverEvents (bool enabled) |
bool | acceptHoverEvents () const const |
void | setAcceptHoverEvents (bool enabled) |
bool | acceptTouchEvents () const const |
void | setAcceptTouchEvents (bool enabled) |
bool | filtersChildEvents () const const |
void | setFiltersChildEvents (bool enabled) |
bool | handlesChildEvents () const const |
void | setHandlesChildEvents (bool enabled) |
bool | isActive () const const |
void | setActive (bool active) |
bool | hasFocus () const const |
void | setFocus (Qt::FocusReason focusReason) |
void | clearFocus () |
QGraphicsItem * | focusProxy () const const |
void | setFocusProxy (QGraphicsItem *item) |
QGraphicsItem * | focusItem () const const |
void | grabMouse () |
void | ungrabMouse () |
void | grabKeyboard () |
void | ungrabKeyboard () |
QPointF | pos () const const |
qreal | x () const const |
void | setX (qreal x) |
qreal | y () const const |
void | setY (qreal y) |
QPointF | scenePos () const const |
void | setPos (const QPointF &pos) |
void | setPos (qreal x, qreal y) |
void | moveBy (qreal dx, qreal dy) |
void | ensureVisible (const QRectF &rect, int xmargin, int ymargin) |
void | ensureVisible (qreal x, qreal y, qreal w, qreal h, int xmargin, int ymargin) |
QMatrix | matrix () const const |
QMatrix | sceneMatrix () const const |
void | setMatrix (const QMatrix &matrix, bool combine) |
void | resetMatrix () |
QTransform | transform () const const |
QTransform | sceneTransform () const const |
QTransform | deviceTransform (const QTransform &viewportTransform) const const |
QTransform | itemTransform (const QGraphicsItem *other, bool *ok) const const |
void | setTransform (const QTransform &matrix, bool combine) |
void | resetTransform () |
void | rotate (qreal angle) |
void | scale (qreal sx, qreal sy) |
void | shear (qreal sh, qreal sv) |
void | translate (qreal dx, qreal dy) |
void | setRotation (qreal angle) |
qreal | rotation () const const |
void | setScale (qreal factor) |
qreal | scale () const const |
QList< QGraphicsTransform * > | transformations () const const |
void | setTransformations (const QList< QGraphicsTransform * > &transformations) |
QPointF | transformOriginPoint () const const |
void | setTransformOriginPoint (const QPointF &origin) |
void | setTransformOriginPoint (qreal x, qreal y) |
virtual void | advance (int phase) |
qreal | zValue () const const |
void | setZValue (qreal z) |
void | stackBefore (const QGraphicsItem *sibling) |
QRectF | childrenBoundingRect () const const |
QRectF | sceneBoundingRect () const const |
bool | isClipped () const const |
QPainterPath | clipPath () const const |
virtual bool | contains (const QPointF &point) const const |
virtual bool | collidesWithItem (const QGraphicsItem *other, Qt::ItemSelectionMode mode) const const |
virtual bool | collidesWithPath (const QPainterPath &path, Qt::ItemSelectionMode mode) const const |
QList< QGraphicsItem * > | collidingItems (Qt::ItemSelectionMode mode) const const |
bool | isObscured (const QRectF &rect) const const |
bool | isObscured (qreal x, qreal y, qreal w, qreal h) const const |
virtual bool | isObscuredBy (const QGraphicsItem *item) const const |
virtual QPainterPath | opaqueArea () const const |
QRegion | boundingRegion (const QTransform &itemToDeviceTransform) const const |
qreal | boundingRegionGranularity () const const |
void | setBoundingRegionGranularity (qreal granularity) |
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)=0 |
void | update (const QRectF &rect) |
void | update (qreal x, qreal y, qreal width, qreal height) |
void | scroll (qreal dx, qreal dy, const QRectF &rect) |
QPointF | mapToItem (const QGraphicsItem *item, const QPointF &point) const const |
QPointF | mapToParent (const QPointF &point) const const |
QPointF | mapToScene (const QPointF &point) const const |
QPolygonF | mapToItem (const QGraphicsItem *item, const QRectF &rect) const const |
QPolygonF | mapToParent (const QRectF &rect) const const |
QPolygonF | mapToScene (const QRectF &rect) const const |
QRectF | mapRectToItem (const QGraphicsItem *item, const QRectF &rect) const const |
QRectF | mapRectToParent (const QRectF &rect) const const |
QRectF | mapRectToScene (const QRectF &rect) const const |
QPolygonF | mapToItem (const QGraphicsItem *item, const QPolygonF &polygon) const const |
QPolygonF | mapToParent (const QPolygonF &polygon) const const |
QPolygonF | mapToScene (const QPolygonF &polygon) const const |
QPainterPath | mapToItem (const QGraphicsItem *item, const QPainterPath &path) const const |
QPainterPath | mapToParent (const QPainterPath &path) const const |
QPainterPath | mapToScene (const QPainterPath &path) const const |
QPointF | mapFromItem (const QGraphicsItem *item, const QPointF &point) const const |
QPointF | mapFromParent (const QPointF &point) const const |
QPointF | mapFromScene (const QPointF &point) const const |
QPolygonF | mapFromItem (const QGraphicsItem *item, const QRectF &rect) const const |
QPolygonF | mapFromParent (const QRectF &rect) const const |
QPolygonF | mapFromScene (const QRectF &rect) const const |
QRectF | mapRectFromItem (const QGraphicsItem *item, const QRectF &rect) const const |
QRectF | mapRectFromParent (const QRectF &rect) const const |
QRectF | mapRectFromScene (const QRectF &rect) const const |
QPolygonF | mapFromItem (const QGraphicsItem *item, const QPolygonF &polygon) const const |
QPolygonF | mapFromParent (const QPolygonF &polygon) const const |
QPolygonF | mapFromScene (const QPolygonF &polygon) const const |
QPainterPath | mapFromItem (const QGraphicsItem *item, const QPainterPath &path) const const |
QPainterPath | mapFromParent (const QPainterPath &path) const const |
QPainterPath | mapFromScene (const QPainterPath &path) const const |
QPointF | mapToItem (const QGraphicsItem *item, qreal x, qreal y) const const |
QPointF | mapToParent (qreal x, qreal y) const const |
QPointF | mapToScene (qreal x, qreal y) const const |
QPolygonF | mapToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const const |
QPolygonF | mapToParent (qreal x, qreal y, qreal w, qreal h) const const |
QPolygonF | mapToScene (qreal x, qreal y, qreal w, qreal h) const const |
QRectF | mapRectToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const const |
QRectF | mapRectToParent (qreal x, qreal y, qreal w, qreal h) const const |
QRectF | mapRectToScene (qreal x, qreal y, qreal w, qreal h) const const |
QPointF | mapFromItem (const QGraphicsItem *item, qreal x, qreal y) const const |
QPointF | mapFromParent (qreal x, qreal y) const const |
QPointF | mapFromScene (qreal x, qreal y) const const |
QPolygonF | mapFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const const |
QPolygonF | mapFromParent (qreal x, qreal y, qreal w, qreal h) const const |
QPolygonF | mapFromScene (qreal x, qreal y, qreal w, qreal h) const const |
QRectF | mapRectFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const const |
QRectF | mapRectFromParent (qreal x, qreal y, qreal w, qreal h) const const |
QRectF | mapRectFromScene (qreal x, qreal y, qreal w, qreal h) const const |
bool | isAncestorOf (const QGraphicsItem *child) const const |
QGraphicsItem * | commonAncestorItem (const QGraphicsItem *other) const const |
bool | isUnderMouse () const const |
QVariant | data (int key) const const |
void | setData (int key, const QVariant &value) |
Qt::InputMethodHints | inputMethodHints () const const |
void | setInputMethodHints (Qt::InputMethodHints hints) |
virtual int | type () const const |
void | installSceneEventFilter (QGraphicsItem *filterItem) |
void | removeSceneEventFilter (QGraphicsItem *filterItem) |
T | qgraphicsitem_cast (QGraphicsItem *item) |
Protected Attributes | |
QString | mNodeText [3] |
qreal | mWidth |
qreal | mHeight |
QMultiHash< u32, int > | mInputByNet |
QMultiHash< u32, int > | mOutputByNet |
![]() | |
ItemType | mItemType |
bool | mHighlight |
u32 | mId |
QColor | mColor |
Abstract base class for nodes (e.g. gates, modules)
Abstract base class of every node in the netlist graph, i.e. GraphicsGates and GraphicsModules.
Definition at line 40 of file graphics_node.h.
Constructor of the abstract class GraphicsNode.
type | - The type of the GraphicsItem (i.e. module, gate or net) |
id | - The id of the underlying object (e.g. the module id if ItemType::Module) |
name | - The name of the node |
Definition at line 9 of file graphics_node.cpp.
References QGraphicsItem::ItemIsSelectable, QGraphicsItem::ItemSendsGeometryChanges, mNodeText, name, and QGraphicsItem::setFlags().
|
overridevirtual |
Get the bounding rectangle of the GrahpicsNode that represent its size. Therefore the returned rectangle is set to position (0, 0) with the width and hight of its GraphicsNode.
Implements QGraphicsItem.
Definition at line 18 of file graphics_node.cpp.
References mHeight, and mWidth.
Referenced by hal::StandardGraphicsGate::paint(), hal::StandardGraphicsModule::paint(), and hal::GatelibraryGraphicsView::showGate().
|
pure virtual |
Given the index of an input/output pin, this function returns the position of this pin in the scene.
(Pins are positioned from top (idx=0) to bottom (idx=maxIdx))
index | - The index of the pin |
isInput | - true if the pin is an input pin
|
Implemented in hal::StandardGraphicsModule, and hal::StandardGraphicsGate.
|
pure virtual |
Given the id of a net and the type of the pin of one of its destinations, this function returns the position of the input pin in the scene.
mNetId | - The net id |
pin_type | - The input pin type |
Implemented in hal::StandardGraphicsModule, and hal::StandardGraphicsGate.
|
pure virtual |
Given the id of a net and the type of the pin of one of its sources, this function returns the position of the output pin in the scene.
mNetId | - The net id |
pin_type | - The output pin type |
Implemented in hal::StandardGraphicsModule, and hal::StandardGraphicsGate.
qreal hal::GraphicsNode::height | ( | ) | const |
Gets the height of the GraphicsNode
Definition at line 42 of file graphics_node.cpp.
References mHeight.
int hal::GraphicsNode::inputByNet | ( | u32 | netId | ) | const |
Given a net by its id, this function returns the index of a pin that is a destination of the net. If no pin of this gate is a destination of this net -1 is returned.
Note(TODO): Undefined behaviour if there are multiple destinations on this gate!
netId | - The id of the net |
Definition at line 73 of file graphics_node.cpp.
References mInputByNet.
Returns the following list:
Definition at line 47 of file graphics_node.cpp.
References mInputByNet, test::n, and QVector::toList().
Referenced by hal::StandardGraphicsGate::paint().
int hal::GraphicsNode::outputByNet | ( | u32 | netId | ) | const |
Given a net by its id, this function returns the index of a pin that is a source of the net. If no pin of this gate is a source of this net -1 is returned.
Note(TODO): Undefined behaviour if there are multiple sources on this gate!
netId | - The id of the net |
Definition at line 78 of file graphics_node.cpp.
References mOutputByNet.
Returns the following list:
Definition at line 60 of file graphics_node.cpp.
References mOutputByNet, test::n, and QVector::toList().
Referenced by hal::StandardGraphicsGate::paint().
void hal::GraphicsNode::set_name | ( | const QString & | name | ) |
Changes the name text of the GraphicsNode to the passed name.
name | - The new name |
Definition at line 83 of file graphics_node.cpp.
|
virtual |
Configures the passed visuals.
v | - The visuals to apply |
Definition at line 30 of file graphics_node.cpp.
References hal::GraphicsItem::mColor, hal::GraphicsNode::Visuals::mMainColor, hal::GraphicsNode::Visuals::mVisible, and QGraphicsItem::setVisible().
|
overridevirtual |
Creates and returns a painter path of the frame of the GraphicsNode.
Reimplemented from QGraphicsItem.
Definition at line 23 of file graphics_node.cpp.
References QPainterPath::addRect(), mHeight, and mWidth.
qreal hal::GraphicsNode::width | ( | ) | const |
Gets the width of the GraphicsNode
Definition at line 37 of file graphics_node.cpp.
References mWidth.
|
pure virtual |
Gets the vertical space between two endpoints (in scene coordinates).
Implemented in hal::StandardGraphicsModule, and hal::StandardGraphicsGate.
|
pure virtual |
Gets the distance between the top edge of the node and the first pin (in scene coordinates).
Implemented in hal::StandardGraphicsModule, and hal::StandardGraphicsGate.
|
protected |
The height of the GraphicsNode
Definition at line 221 of file graphics_node.h.
Referenced by boundingRect(), height(), hal::StandardGraphicsGate::paint(), hal::StandardGraphicsModule::paint(), and shape().
|
protected |
Stores pairs (netId, pinIdx) for every input pin of this gate.
netId=0 implies that no net is connected to the input pin at pinIdx.
Definition at line 229 of file graphics_node.h.
Referenced by hal::GraphicsGate::GraphicsGate(), hal::GraphicsModule::GraphicsModule(), inputByNet(), and inputNets().
|
protected |
The text in the center of the GraphicsNode. Each index stores one line of text. Therefore there is a maximum of 3 lines in total.
Definition at line 211 of file graphics_node.h.
Referenced by hal::GraphicsGate::GraphicsGate(), hal::GraphicsModule::GraphicsModule(), GraphicsNode(), hal::StandardGraphicsGate::paint(), hal::StandardGraphicsModule::paint(), and set_name().
|
protected |
Stores pairs (netId, pinIdx) for every output pin of this gate.
netId=0 implies that no net is connected to the output pin at pinIdx.
Definition at line 235 of file graphics_node.h.
Referenced by hal::GraphicsGate::GraphicsGate(), hal::GraphicsModule::GraphicsModule(), outputByNet(), and outputNets().
|
protected |
The width of the GraphicsNode
Definition at line 216 of file graphics_node.h.
Referenced by boundingRect(), hal::StandardGraphicsGate::endpointPositionByIndex(), hal::StandardGraphicsModule::endpointPositionByIndex(), hal::StandardGraphicsGate::paint(), hal::StandardGraphicsModule::paint(), shape(), and width().