All Classes Namespaces Functions Variables Enumerations Properties Pages
stroketool.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 
18 #ifndef STROKETOOL_H
19 #define STROKETOOL_H
20 
21 #include "basetool.h"
22 #include "pointerevent.h"
23 
24 #include <QList>
25 #include <QPointF>
26 
27 
28 class StrokeTool : public BaseTool
29 {
30  Q_OBJECT
31 
32 public:
33  explicit StrokeTool(QObject* parent);
34 
35  void startStroke(PointerEvent::InputType inputType);
36  void drawStroke();
37  void endStroke();
38 
39  bool keyPressEvent(QKeyEvent* event) override;
40 
41 protected:
42  bool mFirstDraw = false;
43 
44  QList<QPointF> mStrokePoints;
45  QList<qreal> mStrokePressures;
46 
47  qreal mCurrentWidth = 0.0;
48  qreal mCurrentPressure = 0.5;
49 
50  PointerEvent::InputType mCurrentInputType = PointerEvent::Unknown;
51 
57  virtual bool emptyFrameActionEnabled();
58 
59 private:
60  QPointF mLastPixel { 0, 0 };
61 };
62 
63 #endif // STROKETOOL_H
virtual bool emptyFrameActionEnabled()
Whether to enable the "drawing on empty frame" preference.
Definition: stroketool.cpp:89
virtual bool event(QEvent *e)
Q_OBJECTQ_OBJECT
QObject * parent() const const