Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineStateHandleAbstract.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include "EngaugeAssert.h"
8#include "GraphicsScene.h"
9#include "GuidelineAbstract.h"
10#include "GuidelineFormat.h"
11#include "GuidelineState.h"
14#include "Logger.h"
15#include <QPen>
16#include "ZValues.h"
17
22
26
28{
29 // The pen color is irrelevant since doPaint=false below prevents pen/brush drawing
30 GuidelineFormat guidelineFormat (context().color());
31
34 // ItemIsSelectable is overkill, and in special cases adds ugly selected dashes
35 context().guideline().setGraphicsItemFlags (QGraphicsItem::ItemIsFocusable |
36 QGraphicsItem::ItemIsMovable);
38 context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (),
39 guidelineFormat.lineWidthNonHover ());
40}
41
43{
44 return true;
45}
46
48{
49 // Noop
50}
51
53 bool /* locked */)
54{
55 // Noop
56}
57
59{
60 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleAbstract::handleHoverEnterEvent";
61
62 // Noop
63}
64
66{
67 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleAbstract::handleHoverEnterEvent";
68
69 // Noop
70}
71
72void GuidelineStateHandleAbstract::handleMousePress (const QPointF & /* posScene */)
73{
74 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleAbstract::handleMousePress";
75
76 // Noop
77}
78
80{
81 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleAbstract::handleTimeout";
82
83 // Noop
84}
85
log4cpp::Category * mainCat
Definition Logger.cpp:14
const int Z_VALUE_GUIDELINE_HANDLE
Definition ZValues.cpp:14
virtual void setGraphicsItemVisible(bool visible)=0
Wrapper for QGraphicsItem::setVisible.
virtual void setGraphicsItemAcceptHoverEvents(bool accept)=0
Wrapper for QGraphicsItem::setAcceptHoverEvents.
virtual void setGraphicsItemZValue(double z)=0
Wrapper for QGraphicsItem::setZValue.
virtual void setGraphicsItemPen(const QColor &color, double lineWidth)=0
Wrapper for QGraphicsItem::setPen.
virtual void setGraphicsItemFlags(QGraphicsItem::GraphicsItemFlags flags)=0
Wrapper for QGraphicsItem::setFlags.
This class centralizes the formatting information (color, line width, alpha) for the Guidelines.
double lineWidthNonHover() const
Guideline line width for narrow lines.
QColor colorHidden() const
Color when object is transparent but still handling (probably hover) events.
GuidelineStateContext & context() const
Context in charge of the state classes.
GuidelineStateAbstractBase(GuidelineStateContext &context)
Single constructor.
Context class for state machine that belongs to the Guideline class.
GuidelineAbstract & guideline()
Guideline that owns this context class.
virtual void updateWithLatestTransformation()
Update given Transformation in GuidelineStateContext.
virtual void handleHoverEnterEvent()
If transparent then make visible when hover starts.
virtual void handleTimeout()
Handle timeout from Appearing state.
virtual void handleHoverLeaveEvent()
If previously transparent before hover enter then make transparent again.
GuidelineStateHandleAbstract(GuidelineStateContext &context)
Single constructor.
virtual void handleGuidelineMode(bool visible, bool locked)
User toggled Guideline visibility and/or locked mode.
virtual void handleActiveChange(bool active)
DigitizeState change so active status may (or may not) be toggled.
virtual bool doPaint() const
Allow/skip painting of the owner Guideline.
virtual void handleMousePress(const QPointF &posScene)
At the start of dragging, convert the Guideline into an invisible handle and visible slaved deployed ...
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20