Go to the documentation of this file.
18 #include <QGraphicsPixmapItem>
22 m_mainWindow (mainWindow)
35 completeRequestedStateTransitionIfExists();
40 qDeleteAll (m_states);
49 completeRequestedStateTransitionIfExists ();
52 void BackgroundStateContext::completeRequestedStateTransitionIfExists()
56 if (m_currentState != m_requestedState) {
63 m_states [m_currentState]->end ();
67 m_currentState = m_requestedState;
68 m_states [m_requestedState]->begin ();
81 double width = imageItem->boundingRect().width();
82 double height = imageItem->boundingRect().height();
85 <<
" state=" << m_states [m_currentState]->state ().toLatin1().data()
86 <<
" boundingRect=(" << width <<
"x" << height <<
")";
89 view.fitInView (imageItem);
102 m_requestedState = backgroundState;
112 switch (backgroundImage) {
128 completeRequestedStateTransitionIfExists ();
135 const QString &curveSelected)
138 <<
" curve=" << curveSelected.toLatin1().data();
142 m_states [backgroundState]->setCurveSelected (isGnuplot,
154 const QPixmap &pixmapOriginal,
155 const QString &curveSelected)
158 <<
" image=" << pixmapOriginal.width() <<
"x" << pixmapOriginal.height()
159 <<
" currentState=" << m_states [m_currentState]->state().toLatin1().data();
163 m_states [backgroundState]->setPixmap (isGnuplot,
176 const QString &curveSelected)
182 m_states [backgroundState]->updateColorFilter (isGnuplot,
void requestStateTransition(BackgroundState backgroundState)
Initiate state transition to be performed later, when BackgroundState is off the stack.
Background image state for interval between startup and loading of the image.
BackgroundStateContext(MainWindow &mainWindow)
Single constructor.
BackgroundState
Set of possible states of background image.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
void setBackgroundImage(BackgroundImage backgroundImage)
Transition to the specified state. This method is used by classes outside of the state machine to tri...
~BackgroundStateContext()
Destructor deallocates memory.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Background image state for showing original (=unfiltered) image.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
void updateColorFilter(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Apply color filter settings.
#define LOG4CPP_INFO_S(logger)
QString backgroundImageToString(BackgroundImage backgroundImage)
log4cpp::Category * mainCat
void fitInView(GraphicsView &view)
Zoom so background fills the window.
Background image state for showing no image.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void setPixmap(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal, const QString &curveSelected)
Update the images of all states, rather than just the current state.
BackgroundImage
Background selection.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
Background image state for showing filter image from current curve.
void close()
Open Document is being closed so remove the background.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
void setCurveSelected(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.