Engauge Digitizer 2
Loading...
Searching...
No Matches
TutorialStateAbstractBase.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 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 <QGraphicsPixmapItem>
8#include <QGraphicsScene>
9#include <QGraphicsTextItem>
10#include "TutorialDlg.h"
13
14//const int DELTA_FONT_SIZE = 2;
15const int TITLE_PADDING = 5;
16const double Z_TITLE = 2.0; // On top of everything else
17
22
26
28{
29 return 10;
30}
31
36
38 const QPoint &pos)
39{
41 item->setPos (pos);
42 context().tutorialDlg().scene().addItem (item);
43
44 return item;
45}
46
48 const QPoint &pos)
49{
50 QGraphicsTextItem *item = new QGraphicsTextItem (text);
51 item->setPos (pos);
52 context().tutorialDlg().scene().addItem (item);
53
54 return item;
55}
56
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;
73}
const int INNER_RADIUS_MIN
const double Z_TITLE
const int TITLE_PADDING
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
QSize backgroundSize() const
Make geometry available for layout.
TutorialStateAbstractBase(TutorialStateContext &context)
Single constructor.
QGraphicsTextItem * createTitle(const QString &text)
Factory method for title items.
QGraphicsTextItem * createTextItem(const QString &text, const QPoint &pos)
Factory method for text items.
TutorialStateContext & context()
Context class for the tutorial state machine.
QGraphicsPixmapItem * createPixmapItem(const QString &resource, const QPoint &pos)
Factory method for pixmap items.
int buttonMargin() const
Buttons are placed up against bottom side, and left or right side, separated by this margin.
Context class for tutorial state machine.
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.