All Classes Namespaces Functions Variables Enumerations Properties Pages
polylinetool.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 POLYLINETOOL_H
19 #define POLYLINETOOL_H
20 
21 #include <QPointF>
22 
23 #include "basetool.h"
24 
25 class PolylineTool : public BaseTool
26 {
27  Q_OBJECT
28 public:
29  explicit PolylineTool(QObject* parent = 0);
30  ToolType type() override;
31  void loadSettings() override;
32  QCursor cursor() override;
33  void resetToDefault() override;
34 
35  void pointerPressEvent(PointerEvent*) override;
36  void pointerReleaseEvent(PointerEvent*) override;
37  void pointerMoveEvent(PointerEvent* event) override;
38  void pointerDoubleClickEvent(PointerEvent*) override;
39 
40  bool keyPressEvent(QKeyEvent* event) override;
41 
42  void clearToolData() override;
43 
44  void setWidth(const qreal width) override;
45  void setFeather(const qreal feather) override;
46  void setAA(const int AA) override;
47 
48  bool leavingThisTool() override;
49 
50  virtual bool isActive() override;
51 
52 private:
53  QList<QPointF> mPoints;
54 
55  void drawPolyline(QList<QPointF> points, QPointF endPoint);
56  void cancelPolyline();
57  void endPolyline(QList<QPointF> points);
58 };
59 
60 #endif // POLYLINETOOL_H
virtual bool isActive() override
Check if the tool is active.
virtual bool event(QEvent *e)
Q_OBJECTQ_OBJECT
QObject * parent() const const