Loading...
Searching...
No Matches
Inheritance diagram for Dataflow::PortItem:
Dataflow::AutomatablePortItem Dataflow::AudioOutletItem Dataflow::MinMaxFloatOutletItem vst3::VSTControlPortItem vst::ControlPortItem

Public Member Functions

 PortItem (const Process::Port &p, const Process::Context &ctx, QGraphicsItem *parent)
 
const Process::Port & port () const
 
virtual void setupMenu (QMenu &, const score::DocumentContext &ctx)
 
void setPortVisible (bool b)
 
void resetPortVisible ()
 
void resetDrop ()
 
void setHighlight (bool b)
 
bool highlighted () const noexcept
 
QRectF drawnRect () const noexcept
 
int type () const final override
 
QPointF sceneCenter () const noexcept
 portCenter() in scene coordinates, taking the item's transform into account.
 
QRectF boundingRect () const override
 
QPainterPath shape () const override
 
bool contains (const QPointF &point) const override
 
bool collidesWithPath (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const override
 
void createCable (PortItem *src, PortItem *snk)
 
void contextMenuRequested (QPointF scenepos, QPoint pos)
 

Static Public Member Functions

static constexpr QPointF portCenter () noexcept
 
static const QPixmap & portImage (Process::PortType t, bool inlet, bool smol, bool light, bool addr) noexcept
 

Public Attributes

AddressPropagationItem * m_address {}
 
double m_diam = 8.
 
bool m_visible {true}
 
bool m_inlet {true}
 
bool m_highlight {true}
 

Static Public Attributes

static PortItem * clickedPort
 
static const constexpr int Type = QGraphicsItem::UserType + 700
 
static constexpr double hitRadius = 4.
 

Protected Member Functions

void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *event) final override
 
void hoverMoveEvent (QGraphicsSceneHoverEvent *event) final override
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) final override
 
void dragEnterEvent (QGraphicsSceneDragDropEvent *event) final override
 
void dragMoveEvent (QGraphicsSceneDragDropEvent *event) final override
 
void dragLeaveEvent (QGraphicsSceneDragDropEvent *event) final override
 
void keyPressEvent (QKeyEvent *event) override
 
void keyReleaseEvent (QKeyEvent *event) override
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 

Protected Attributes

const Process::Context & m_context
 
std::vector< QPointer< CableItem > > cables
 
const Process::Port & m_port
 

Friends

class Dataflow::CableItem
 

Member Function Documentation

◆ collidesWithPath()

bool Dataflow::PortItem::collidesWithPath ( const QPainterPath &  path,
Qt::ItemSelectionMode  mode = Qt::IntersectsItemShape 
) const
override

For an item inside a parent that clips its children (a nodal slot), Qt hit-tests the clip path - which starts from the bounding rect, not the shape - instead of the shape, so the port would grab the pointer over its whole bounding rect. Tests the shape, cut by the clip.

◆ drawnRect()

QRectF Dataflow::PortItem::drawnRect ( ) const
inlinenoexcept

What paint() actually draws, as opposed to boundingRect(), which is deliberately larger. The ellipse is inset by one pixel at the small size and by three at the large one; see PortStyle in the .cpp.

◆ portCenter()

static constexpr QPointF Dataflow::PortItem::portCenter ( )
inlinestaticconstexprnoexcept

Center of the drawn port circle, in item coordinates. Cables, the drag line and magnetic snapping all anchor on this point.

Member Data Documentation

◆ hitRadius

constexpr double Dataflow::PortItem::hitRadius = 4.
staticconstexpr

Radius of the clickable zone around portCenter(): the drawn circle (radius 3 and a 1.5px pen) and its antialiased edge. The hand cursor follows this zone.


The documentation for this class was generated from the following files: