15#include <QGraphicsLineItem>
16#include <QGraphicsScene>
17#include <QGraphicsSceneMouseEvent>
31 m_mainWindow (mainWindow)
39 guidelineStateInitial));
53 return acceptHoverEvents();
58 return QGraphicsLineItem::isSelected();
63 return QGraphicsLineItem::flags ();
70 QGraphicsLineItem::hoverEnterEvent (event);
77 QGraphicsLineItem::hoverLeaveEvent (event);
89 QGraphicsLineItem::mouseMoveEvent (event);
98 QGraphicsLineItem::mousePressEvent (event);
105 QGraphicsLineItem::mouseReleaseEvent (event);
111 const QStyleOptionGraphicsItem *option,
116 QGraphicsLineItem::paint (painter,
127 scene->removeItem (
this);
132 QGraphicsLineItem::setAcceptHoverEvents (accept);
137 QGraphicsLineItem::setFlags (flags);
142 QGraphicsLineItem::setLine (line);
148 QBrush brush (color);
156 QGraphicsLineItem::setVisible (visible);
161 QGraphicsLineItem::setZValue (z);
169 QPen p = QGraphicsLineItem::pen();
170 QBrush br = p.brush();
171 double alphaF = br.color().alphaF();
172 double lineWidth = p.width ();
175 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.
GuidelineLine(QGraphicsScene &scene, MainWindow &mainWindow, Guidelines &guidelines, GuidelineState guidelineStateInitial, const QString &identifier)
Single constructor.
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.
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.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
#define LOG4CPP_DEBUG_S(logger)