Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineStateDeployedConstantXSelectEditAppearing.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 "GuidelineAbstract.h"
9#include "GuidelineState.h"
12#include "Logger.h"
13#include <QObject>
14#include <QTimer>
15#include "Transformation.h"
16
24
28
30{
31 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXSelectEditAppearing::begin"
32 << " identifier=" << context().guideline().identifier().toLatin1().data();
33
34 beginCommon (true,
35 false);
36
37 context().guideline().setGraphicsItemVisible (true); // Stop hover and painting (doPoint only stops painting)
38
39 // (Re)connect to timer
40 QObject::connect (m_timer, SIGNAL (timeout ()), &context(), SLOT (slotTimeout ()));
41 m_timer->start (APPEARING_TIMEOUT);
42}
43
48
50{
51 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDeployedConstantXSelectEditAppearing::end";
52
53 // Cancel timer if active so it does not interrupt the next state
54 QObject::disconnect (m_timer, SIGNAL (timeout ()), &context(), SLOT (slotTimeout ()));
55}
56
63
65 bool locked)
66{
67 // Currently visible and not locked
68 if (visible && locked) {
70 } else if (!visible) {
72 }
73}
74
79
83
90
95
const int APPEARING_TIMEOUT
Milliseconds before transition from Appearing state to Active state.
QString guidelineStateAsString(GuidelineState state)
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_HIDE
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT_APPEARING
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_UNSELECT_EDIT
@ GUIDELINE_STATE_HANDLE_X
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_LOCK
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT_HOVER
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT
log4cpp::Category * mainCat
Definition Logger.cpp:14
virtual QString identifier() const =0
Unique identifier from QGraphicsItem.
virtual void setGraphicsItemVisible(bool visible)=0
Wrapper for QGraphicsItem::setVisible.
void handleMousePressCommon(const QPointF &posAbsolute, GuidelineState stateHandle, GuidelineState stateDeployed)
Common mouse press handling.
GuidelineStateContext & context() const
Context in charge of the state classes.
Context class for state machine that belongs to the Guideline class.
GuidelineAbstract & guideline()
Guideline that owns this context class.
void requestStateTransition(GuidelineState guidelineState)
Request a state transition.
void beginCommon(bool hovering, bool locked)
Initialization common to all states.
GuidelineStateDeployedConstantXAbstract(GuidelineStateContext &context)
Single constructor.
virtual void handleHoverLeaveEvent()
If previously transparent before hover enter then make transparent again.
virtual void handleMousePress(const QPointF &posScene)
At the start of dragging, convert the Guideline into an invisible handle and visible slaved deployed ...
GuidelineStateDeployedConstantXSelectEditAppearing(GuidelineStateContext &context)
Single constructor.
virtual bool doPaint() const
Allow/skip painting of the owner Guideline.
virtual QString stateName() const
Name of state as a string for debugging only.
virtual void handleHoverEnterEvent()
If transparent then make visible when hover starts.
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.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18