Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Guideline
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 "
GuidelineState.h
"
11
#include "
GuidelineStateContext.h
"
12
#include "
GuidelineStateHandleAbstract.h
"
13
#include "
Logger.h
"
14
#include <QPen>
15
#include "
ZValues.h
"
16
17
GuidelineStateHandleAbstract::GuidelineStateHandleAbstract
(
GuidelineStateContext
&
context
) :
18
GuidelineStateAbstractBase
(
context
)
19
{
20
}
21
22
GuidelineStateHandleAbstract::~GuidelineStateHandleAbstract
()
23
{
24
}
25
26
void
GuidelineStateHandleAbstract::beginCommon
()
27
{
28
context
().
guideline
().
setGraphicsItemZValue
(
Z_VALUE_GUIDELINE_HANDLE
);
29
context
().
guideline
().
setGraphicsItemVisible
(
true
);
30
// ItemIsSelectable is overkill, and in special cases adds ugly selected dashes
31
context
().
guideline
().
setGraphicsItemFlags
(QGraphicsItem::ItemIsFocusable |
32
QGraphicsItem::ItemIsMovable);
33
context
().
guideline
().
setGraphicsItemAcceptHoverEvents
(
false
);
34
context
().
guideline
().
setGraphicsItemPen
(QColor (Qt::transparent),
35
context
().modelGuideline ().lineWidthInactive ());
36
}
37
38
bool
GuidelineStateHandleAbstract::doPaint
()
const
39
{
40
return
true
;
41
}
42
43
void
GuidelineStateHandleAbstract::handleActiveChange
(
bool
/* active */
)
44
{
45
// Noop
46
}
47
48
void
GuidelineStateHandleAbstract::handleGuidelineMode
(
bool
/* visible */
,
49
bool
/* locked */
)
50
{
51
// Noop
52
}
53
54
void
GuidelineStateHandleAbstract::handleHoverEnterEvent
()
55
{
56
qCDebug(ENGAUGE_LOG) <<
"GuidelineStateHandleAbstract::handleHoverEnterEvent"
;
57
58
// Noop
59
}
60
61
void
GuidelineStateHandleAbstract::handleHoverLeaveEvent
()
62
{
63
qCDebug(ENGAUGE_LOG) <<
"GuidelineStateHandleAbstract::handleHoverEnterEvent"
;
64
65
// Noop
66
}
67
68
void
GuidelineStateHandleAbstract::handleMousePress
(
const
QPointF &
/* posScene */
)
69
{
70
qCDebug(ENGAUGE_LOG) <<
"GuidelineStateHandleAbstract::handleMousePress"
;
71
72
// Noop
73
}
74
75
void
GuidelineStateHandleAbstract::handleTimeout
()
76
{
77
qCDebug(ENGAUGE_LOG) <<
"GuidelineStateHandleAbstract::handleTimeout"
;
78
79
// Noop
80
}
81
82
void
GuidelineStateHandleAbstract::updateWithLatestTransformation
()
83
{
84
// Noop
85
}
EngaugeAssert.h
GraphicsScene.h
GuidelineAbstract.h
GuidelineStateContext.h
GuidelineStateHandleAbstract.h
GuidelineState.h
Logger.h
Z_VALUE_GUIDELINE_HANDLE
const int Z_VALUE_GUIDELINE_HANDLE
Definition
ZValues.cpp:14
ZValues.h
GuidelineAbstract::setGraphicsItemVisible
virtual void setGraphicsItemVisible(bool visible)=0
Wrapper for QGraphicsItem::setVisible.
GuidelineAbstract::setGraphicsItemAcceptHoverEvents
virtual void setGraphicsItemAcceptHoverEvents(bool accept)=0
Wrapper for QGraphicsItem::setAcceptHoverEvents.
GuidelineAbstract::setGraphicsItemZValue
virtual void setGraphicsItemZValue(double z)=0
Wrapper for QGraphicsItem::setZValue.
GuidelineAbstract::setGraphicsItemPen
virtual void setGraphicsItemPen(const QColor &color, double lineWidth)=0
Wrapper for QGraphicsItem::setPen.
GuidelineAbstract::setGraphicsItemFlags
virtual void setGraphicsItemFlags(QGraphicsItem::GraphicsItemFlags flags)=0
Wrapper for QGraphicsItem::setFlags.
GuidelineStateAbstractBase::context
GuidelineStateContext & context() const
Context in charge of the state classes.
Definition
GuidelineStateAbstractBase.cpp:27
GuidelineStateAbstractBase::GuidelineStateAbstractBase
GuidelineStateAbstractBase(GuidelineStateContext &context)
Single constructor.
Definition
GuidelineStateAbstractBase.cpp:18
GuidelineStateContext
Context class for state machine that belongs to the Guideline class.
Definition
GuidelineStateContext.h:132
GuidelineStateContext::guideline
GuidelineAbstract & guideline()
Guideline that owns this context class.
Definition
GuidelineStateContext.cpp:155
GuidelineStateHandleAbstract::updateWithLatestTransformation
virtual void updateWithLatestTransformation()
Update given Transformation in GuidelineStateContext.
Definition
GuidelineStateHandleAbstract.cpp:82
GuidelineStateHandleAbstract::handleHoverEnterEvent
virtual void handleHoverEnterEvent()
If transparent then make visible when hover starts.
Definition
GuidelineStateHandleAbstract.cpp:54
GuidelineStateHandleAbstract::handleTimeout
virtual void handleTimeout()
Handle timeout from Appearing state.
Definition
GuidelineStateHandleAbstract.cpp:75
GuidelineStateHandleAbstract::handleHoverLeaveEvent
virtual void handleHoverLeaveEvent()
If previously transparent before hover enter then make transparent again.
Definition
GuidelineStateHandleAbstract.cpp:61
GuidelineStateHandleAbstract::GuidelineStateHandleAbstract
GuidelineStateHandleAbstract(GuidelineStateContext &context)
Single constructor.
Definition
GuidelineStateHandleAbstract.cpp:17
GuidelineStateHandleAbstract::beginCommon
void beginCommon()
Definition
GuidelineStateHandleAbstract.cpp:26
GuidelineStateHandleAbstract::handleGuidelineMode
virtual void handleGuidelineMode(bool visible, bool locked)
User toggled Guideline visibility and/or locked mode.
Definition
GuidelineStateHandleAbstract.cpp:48
GuidelineStateHandleAbstract::handleActiveChange
virtual void handleActiveChange(bool active)
DigitizeState change so active status may (or may not) be toggled.
Definition
GuidelineStateHandleAbstract.cpp:43
GuidelineStateHandleAbstract::doPaint
virtual bool doPaint() const
Allow/skip painting of the owner Guideline.
Definition
GuidelineStateHandleAbstract.cpp:38
GuidelineStateHandleAbstract::~GuidelineStateHandleAbstract
virtual ~GuidelineStateHandleAbstract()
Definition
GuidelineStateHandleAbstract.cpp:22
GuidelineStateHandleAbstract::handleMousePress
virtual void handleMousePress(const QPointF &posScene)
At the start of dragging, convert the Guideline into an invisible handle and visible slaved deployed ...
Definition
GuidelineStateHandleAbstract.cpp:68
Generated on
for Engauge Digitizer by
1.17.0