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
3
Pencil2D - Traditional Animation Software
4
Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5
Copyright (C) 2012-2020 Matthew Chiawen Chang
6
Copyright (C) 2025-2099 Oliver S. Larsen
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; version 2 of the License.
11
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
17
*/
18
#ifndef RADIALOFFSETTOOL_H
19
#define RADIALOFFSETTOOL_H
20
21
#include <QObject>
22
#include <QPointF>
23
24
class
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
*/
39
class
RadialOffsetTool
:
public
QObject
40
{
41
Q_OBJECT
42
public
:
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
54
signals:
55
void
offsetChanged(qreal distance);
56
57
private
:
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