15#include <QGraphicsLineItem>
16#include <QGraphicsScene>
17#include <QGraphicsSceneMouseEvent>
36 guidelineStateInitial));
50 return acceptHoverEvents();
55 return QGraphicsLineItem::isSelected();
60 return QGraphicsLineItem::flags ();
67 QGraphicsLineItem::hoverEnterEvent (event);
74 QGraphicsLineItem::hoverLeaveEvent (event);
86 QGraphicsLineItem::mouseMoveEvent (event);
95 QGraphicsLineItem::mousePressEvent (event);
102 QGraphicsLineItem::mouseReleaseEvent (event);
108 const QStyleOptionGraphicsItem *option,
113 QGraphicsLineItem::paint (painter,
124 scene->removeItem (
this);
129 QGraphicsLineItem::setAcceptHoverEvents (accept);
134 QGraphicsLineItem::setFlags (flags);
139 QGraphicsLineItem::setLine (line);
145 QBrush brush (color);
153 QGraphicsLineItem::setVisible (visible);
158 QGraphicsLineItem::setZValue (z);
166 QPen p = QGraphicsLineItem::pen();
167 QBrush br = p.brush();
168 double alphaF = br.color().alphaF();
169 double lineWidth = p.width ();
172 color.setAlphaF (alphaF);
@ DATA_KEY_GRAPHICS_ITEM_TYPE
QColor ColorPaletteToQColor(ColorPalette color)
@ GRAPHICS_ITEM_TYPE_GUIDELINE
GuidelineState
Set of possible Guideline states. See class Guideline for more information.
log4cpp::Category * mainCat
QGraphicsScene & scene()
GraphicsScene that owns this class.
void handleMousePressEvent(const QPointF &posScene)
Forward press event to state machine.
void setContext(GuidelineStateContext *context)
Create state machine after virtual methods of child classes have been defined.
void handleMouseMoveEvent(const QPointF &posScene)
Forward movements to visible Guideline.
void handleMouseReleaseEvent(const QPointF &posScene)
Cleanup after being dragged.
GuidelineStateContext * context()
State machine context owned by this class.
void handleHoverEnterEvent()
Highlight this Guideline upon hover enter.
void handleHoverLeaveEvent()
Unset highlighting triggered by hover enter.
GuidelineAbstract(QGraphicsScene &scene)
Single constructor.
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Unset highlighting triggered by hover enter.
virtual QGraphicsItem::GraphicsItemFlags graphicsItemFlags() const
Wraps QGraphicsItem::flags.
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Forward movements to visible Guideline.
virtual void setGraphicsItemZValue(double z)
Wrapper for QGraphicsItem::setZValue.
virtual void updateGeometry(double valueGraph)
Update the geometry so it passes through the specified coordinate value in graph coordinates.
virtual QString identifier() const
Unique identifier from QGraphicsItem.
GuidelineLine(QGraphicsScene &scene, Guidelines &guidelines, GuidelineState guidelineStateInitial, const QString &identifier)
Single constructor.
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Highlight this Guideline upon hover enter.
virtual void setGraphicsItemFlags(QGraphicsItem::GraphicsItemFlags flags)
Wrapper for QGraphicsItem::setFlags.
virtual void removeFromScene(QGraphicsScene *scene)
Make graphics item remove itself from the scene.
virtual void updateColor()
Force a color update.
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Cleanup after being dragged.
virtual void setGraphicsItemVisible(bool visible)
Wrapper for QGraphicsItem::setVisible.
virtual void setGraphicsItemLine(const QLineF &line)
Wrapper for QGraphicsLineItem::setLine.
virtual bool getGraphicsItemAcceptHover() const
Return true if accepting hover events.
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Forward press event to state machine.
virtual bool getGraphicsItemSelected() const
Wrapper for QGraphicsItem::isSelected.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=Q_NULLPTR)
Override painting so this disappears when selected. Selected Guidelines are never visible.
virtual void setGraphicsItemPen(const QColor &color, double lineWidth)
Wrapper for QGraphicsItem::setPen.
virtual void setGraphicsItemAcceptHoverEvents(bool accept)
Wrapper for QGraphicsItem::setAcceptHoverEvents.
Context class for state machine that belongs to the Guideline class.
Transformation transformation() const
Return copy of transformation owned by MainWindow.
void setPosCursorGraph(const QPointF &posGraph)
Pass the current cursor coordinate to the state so it can save the relevant coordinate for later adju...
QLineF pointToLine(const QPointF &posScreen) const
Return line parallel to an axis line, that passes through the specified point.
This class contains all Guideline objects.
#define LOG4CPP_DEBUG_S(logger)