Engauge Digitizer  2
Public Member Functions | Protected Member Functions | List of all members
TutorialStateAbstractBase Class Referenceabstract

One state manages one panel of the tutorial. More...

#include <TutorialStateAbstractBase.h>

Inheritance diagram for TutorialStateAbstractBase:
Inheritance graph
Collaboration diagram for TutorialStateAbstractBase:
Collaboration graph

Public Member Functions

 TutorialStateAbstractBase (TutorialStateContext &context)
 Single constructor. More...
 
virtual ~TutorialStateAbstractBase ()
 
virtual void begin ()=0
 Transition into this state. More...
 
virtual void end ()=0
 Transition out of this state. More...
 

Protected Member Functions

int buttonMargin () const
 Buttons are placed up against bottom side, and left or right side, separated by this margin. More...
 
TutorialStateContextcontext ()
 Context class for the tutorial state machine. More...
 
QGraphicsPixmapItem * createPixmapItem (const QString &resource, const QPoint &pos)
 Factory method for pixmap items. More...
 
QGraphicsTextItem * createTextItem (const QString &text, const QPoint &pos)
 Factory method for text items. More...
 
QGraphicsTextItem * createTitle (const QString &text)
 Factory method for title items. More...
 

Detailed Description

One state manages one panel of the tutorial.

Definition at line 29 of file TutorialStateAbstractBase.h.

Constructor & Destructor Documentation

◆ TutorialStateAbstractBase()

TutorialStateAbstractBase::TutorialStateAbstractBase ( TutorialStateContext context)

Single constructor.

Definition at line 17 of file TutorialStateAbstractBase.cpp.

18  :
19  m_context (context)
20 {

◆ ~TutorialStateAbstractBase()

TutorialStateAbstractBase::~TutorialStateAbstractBase ( )
virtual

Definition at line 22 of file TutorialStateAbstractBase.cpp.

24 {

Member Function Documentation

◆ begin()

virtual void TutorialStateAbstractBase::begin ( )
pure virtual

◆ buttonMargin()

int TutorialStateAbstractBase::buttonMargin ( ) const
protected

Buttons are placed up against bottom side, and left or right side, separated by this margin.

Definition at line 26 of file TutorialStateAbstractBase.cpp.

28 {
29  return 10;

◆ context()

TutorialStateContext & TutorialStateAbstractBase::context ( )
protected

Context class for the tutorial state machine.

Definition at line 31 of file TutorialStateAbstractBase.cpp.

33 {
34  return m_context;

◆ createPixmapItem()

QGraphicsPixmapItem * TutorialStateAbstractBase::createPixmapItem ( const QString &  resource,
const QPoint &  pos 
)
protected

Factory method for pixmap items.

Definition at line 36 of file TutorialStateAbstractBase.cpp.

39 {
40  QGraphicsPixmapItem *item = new QGraphicsPixmapItem (QPixmap (resource));
41  item->setPos (pos);
42  context().tutorialDlg().scene().addItem (item);
43 
44  return item;

◆ createTextItem()

QGraphicsTextItem * TutorialStateAbstractBase::createTextItem ( const QString &  text,
const QPoint &  pos 
)
protected

Factory method for text items.

Definition at line 46 of file TutorialStateAbstractBase.cpp.

49 {
50  QGraphicsTextItem *item = new QGraphicsTextItem (text);
51  item->setPos (pos);
52  context().tutorialDlg().scene().addItem (item);
53 
54  return item;

◆ createTitle()

QGraphicsTextItem * TutorialStateAbstractBase::createTitle ( const QString &  text)
protected

Factory method for title items.

Definition at line 56 of file TutorialStateAbstractBase.cpp.

58 {
59  QSize backgroundSize = context().tutorialDlg().backgroundSize();
60 
61  QGraphicsTextItem *item = new QGraphicsTextItem (text);
62  item->setZValue(Z_TITLE);
63  item->setPos (backgroundSize.width() / 2.0 - item->boundingRect().width() / 2.0,
65  context().tutorialDlg().scene().addItem (item);
66 
67  // Highlight the text
68  QFont font = item->font();
69  font.setBold (true);
70 // font.setPixelSize (font.pixelSize() + DELTA_FONT_SIZE);
71  item->setFont (font);
72  return item;

◆ end()

virtual void TutorialStateAbstractBase::end ( )
pure virtual

The documentation for this class was generated from the following files:
TutorialStateAbstractBase::context
TutorialStateContext & context()
Context class for the tutorial state machine.
Definition: TutorialStateAbstractBase.cpp:31
TITLE_PADDING
const int TITLE_PADDING
Definition: TutorialStateAbstractBase.cpp:14
TutorialDlg::scene
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
Definition: TutorialDlg.cpp:76
Z_TITLE
const double Z_TITLE
Definition: TutorialStateAbstractBase.cpp:15
TutorialDlg::backgroundSize
QSize backgroundSize() const
Make geometry available for layout.
Definition: TutorialDlg.cpp:44
TutorialStateContext::tutorialDlg
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.
Definition: TutorialStateContext.cpp:109