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
radialoffsettool.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6Copyright (C) 2025-2099 Oliver S. Larsen
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; version 2 of the License.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17*/
18#ifndef RADIALOFFSETTOOL_H
19#define RADIALOFFSETTOOL_H
20
21#include <QObject>
22#include <QPointF>
23
24class PointerEvent;
25
26/*
27 * A tool that can be used to make quick adjustments
28 * based on an offset vector from current pointer position
29 *
30 * Drag origin Cursor position
31 ● ●
32 | /
33 | /
34 | offset vector /
35 | /
36 ▼ ▼
37 [Adjusted Point] —————————————> (Direction of drag)
38*/
39class RadialOffsetTool : public QObject
40{
41 Q_OBJECT
42public:
43 RadialOffsetTool(QObject* parent = nullptr);
44 ~RadialOffsetTool();
45
46 void setOffset(qreal offset) { mOffset = offset; }
47 void pointerEvent(PointerEvent* event);
48
49 void stopAdjusting();
50 bool isAdjusting() const { return mIsAdjusting; }
51
52 const QPointF& offsetPoint() const { return mAdjustPoint; }
53
54signals:
55 void offsetChanged(qreal distance);
56
57private:
58
59 bool startAdjusting(PointerEvent* event);
60 void adjust(PointerEvent* event);
61
62 bool mIsAdjusting = false;
63 qreal mOffset = 0.;
64 QPointF mAdjustPoint = QPointF();
65};
66
67#endif // RADIALOFFSETTOOL_H
PointerEvent
Definition: pointerevent.h:8
RadialOffsetTool
Definition: radialoffsettool.h:40
QObject
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::event
virtual bool event(QEvent *e)
QObject::parent
QObject * parent() const const
QPointF
Generated on Fri Dec 19 2025 07:54:21 for Pencil2D by doxygen 1.9.6 based on revision 7fd8cd9e03f2d31750e199ecec202e5c0f30e532