Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineStateDeployedAbstract.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 "EnumsToQt.h"
9#include "GraphicsScene.h"
10#include "GuidelineAbstract.h"
13#include "Logger.h"
14#include <QPen>
15#include "ZValues.h"
16
21
25
27 bool locked)
28{
31
32 if (locked) {
33
34 // Prevent interaction. ItemIsSelectable is overkill, and in special cases adds ugly selected dashes
35 QGraphicsItem::GraphicsItemFlags flags = context().guideline ().graphicsItemFlags();
36 flags &= ~QGraphicsItem::ItemIsFocusable;
37 flags &= ~QGraphicsItem::ItemIsMovable;
40
41 const DocumentModelGuideline &modelGuideline = context ().modelGuideline ();
42
44 modelGuideline.lineWidthInactive ());
45
46 } else {
47
48 // Give feedback when user hovers
49 context().guideline().setGraphicsItemFlags (QGraphicsItem::ItemIsFocusable |
50 QGraphicsItem::ItemIsMovable);
52
53 const DocumentModelGuideline &modelGuideline = context ().modelGuideline ();
54
56 hovering ? modelGuideline.lineWidthActive () : modelGuideline.lineWidthInactive ());
57 }
58}
59
61{
62 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateDeployedAbstract::end";
63}
64
65void GuidelineStateDeployedAbstract::handleMouseRelease (const QPointF & /* posScene */)
66{
67 // Noop
68}
69
74
QColor ColorPaletteToQColor(ColorPalette color)
Definition EnumsToQt.cpp:16
log4cpp::Category * mainCat
Definition Logger.cpp:14
const int Z_VALUE_GUIDELINE_DEPLOYED
Definition ZValues.cpp:12
Model for managing the coordinate values corresponding Guidelines.
double lineWidthInactive() const
Get method for line width when inactive.
ColorPalette lineColor() const
Get method for line color.
double lineWidthActive() const
Get method for line width when active.
virtual void setGraphicsItemVisible(bool visible)=0
Wrapper for QGraphicsItem::setVisible.
virtual QGraphicsItem::GraphicsItemFlags graphicsItemFlags() const =0
Wraps QGraphicsItem::flags.
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.
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.
DocumentModelGuideline modelGuideline() const
Up-to-date guideline settings.
virtual void handleTimeout()
Handle timeout from Appearing state.
GuidelineStateDeployedAbstract(GuidelineStateContext &context)
Single constructor.
void beginCommon(bool hovering, bool locked)
Initialization common to all states.
virtual void handleMouseRelease(const QPointF &posScene)
At the end of dragging, clone the Guideline that owns the state machine where these states live.
virtual void end()
Transition out of state.
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20