Skui 0.0.1
Build fast and easy to use control software with Skui.
 
Loading...
Searching...
No Matches
Cable Class Reference

#include <cable.hpp>

Inheritance diagram for Cable:

Public Member Functions

 Cable (QGraphicsItem *parent, const Pad *start_pad)
 
void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
 
QRectF boundingRect () const override
 
void setEditable (bool editable)
 Sets whether the Cable is editable.
 
bool isEditable () const
 Returns whether the Cable is editable.
 

Protected Member Functions

void previewCable (QPoint point)
 Previews the current position of the cable.
 
void corner ()
 Locks a point as a new corner or moves the latest corner.
 
void endCorner (QPoint point)
 For the last corner before ending the Cable.
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 
void hoverMoveEvent (QGraphicsSceneHoverEvent *event) override
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override
 
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 

Constructor & Destructor Documentation

◆ Cable()

Cable::Cable ( QGraphicsItem * parent,
const Pad * start_pad )
explicit

Member Function Documentation

◆ boundingRect()

QRectF Cable::boundingRect ( ) const
override

◆ corner()

void Cable::corner ( )
protected

Locks a point as a new corner or moves the latest corner.

This method creates a new corner if the point is the oposite direction. The point is at the position of the previewed cable.

See also
Cable::previewCable(QPoint point)

◆ endCorner()

void Cable::endCorner ( QPoint point)
protected

For the last corner before ending the Cable.

This method is for calling the last corner at the given point.

Parameters
pointThe position where the cable ends.

◆ hoverLeaveEvent()

void Cable::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event)
overrideprotected

◆ hoverMoveEvent()

void Cable::hoverMoveEvent ( QGraphicsSceneHoverEvent * event)
overrideprotected

◆ isEditable()

bool Cable::isEditable ( ) const
inline

Returns whether the Cable is editable.

This method returns whether the Cable is editable. If true, the Cable can be edited by the user, meaning that the user can move the corners and connect it to Pads. If false, the Cable is fixed and cannot be edited by the user.

Returns
Whether the Cable is editable.
See also
Cable::setEditable(bool editable)

◆ itemChange()

QVariant Cable::itemChange ( GraphicsItemChange change,
const QVariant & value )
overrideprotected

◆ mousePressEvent()

void Cable::mousePressEvent ( QGraphicsSceneMouseEvent * event)
overrideprotected

◆ paint()

void Cable::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )
override

◆ previewCable()

void Cable::previewCable ( QPoint point)
protected

Previews the current position of the cable.

This method renders a preview where the cable would be. Due to the regulation that cables can only be horizontal or vertical, the preview decides if it uses a horizontal or vertical based on the angle to the latest corner.

To enter a position, use corner(QPoint).

Parameters
pointThe position to render the preview, normally the current mouse position.
See also
Cable::corner(QPoint point)

◆ setEditable()

void Cable::setEditable ( bool editable)

Sets whether the Cable is editable.

This method sets wether the Cable is editable. If true, the Cable can be edited by the user, meaning that the user can move the corners and connect it to Pads. If false, the Cable is fixed and cannot be edited by the user.

The default value at construction is true.

Note: The bounding rect is the size of the scene in edit mode and will be shrink to the size of the Cable when not editable.

Parameters
editableWhether the Cable is editable.
See also
Cable::isEditable()

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