Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • tool
polylinetool.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17
18#ifndef POLYLINETOOL_H
19#define POLYLINETOOL_H
20
21#include <QPointF>
22
23#include "stroketool.h"
24
25class PolylineTool : public StrokeTool
26{
27 Q_OBJECT
28public:
29 explicit PolylineTool(QObject* parent = 0);
30
31 ToolType type() const override;
32
33 ToolProperties& toolProperties() override { return mSettings.toolProperties(); }
34 const StrokeToolProperties& strokeToolProperties() const override { return mSettings.strokeToolProperties(); }
35 const PolylineToolProperties& settings() const { return mSettings; }
36
37 void loadSettings() override;
38 QCursor cursor() override;
39
40 void setUseBezier(bool useBezier);
41 void setClosePath(bool closePath);
42
43 void pointerPressEvent(PointerEvent*) override;
44 void pointerReleaseEvent(PointerEvent*) override;
45 void pointerMoveEvent(PointerEvent* event) override;
46 void pointerDoubleClickEvent(PointerEvent*) override;
47
48 bool keyPressEvent(QKeyEvent* event) override;
49 bool keyReleaseEvent(QKeyEvent* event) override;
50
51 void clearToolData() override;
52
53 bool leavingThisTool() override;
54
55 bool isActive() const override;
56
57signals:
58 void bezierPathEnabledChanged(bool useBezier);
59 void closePathChanged(bool closePath);
60
61
62private:
63 PolylineToolProperties mSettings;
64 QList<QPointF> mPoints;
65 bool mClosedPathOverrideEnabled = false;
66
67 void drawPolyline(QList<QPointF> points, QPointF endPoint);
68 void removeLastPolylineSegment();
69 void cancelPolyline();
70 void endPolyline(QList<QPointF> points);
71
72};
73
74#endif // POLYLINETOOL_H
PointerEvent
Definition: pointerevent.h:8
PolylineTool
Definition: polylinetool.h:26
PolylineTool::isActive
bool isActive() const override
Check if the tool is active.
Definition: polylinetool.cpp:87
PolylineTool::leavingThisTool
bool leavingThisTool() override
Will clean up active connections.
Definition: polylinetool.cpp:77
StrokeTool
Definition: stroketool.h:35
QCursor
QKeyEvent
QList
QObject
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::event
virtual bool event(QEvent *e)
QObject::parent
QObject * parent() const const
QPointF
PolylineToolProperties
This struct is an example of how we can share properties among tools rather than duplicating logic,...
Definition: toolproperties.h:454
StrokeToolProperties
Definition: toolproperties.h:395
ToolProperties
Definition: toolproperties.h:204
Generated on Thu Jan 29 2026 05:10:58 for Pencil2D by doxygen 1.9.6 based on revision 2c971b937d0608b05aa496b0f7e9aebcddf8e7fc