22#include "viewmanager.h"
23#include "scribblearea.h"
24#include "strokeinterpolator.h"
25#include "pointerevent.h"
27QString BaseTool::TypeName(ToolType type)
29 static std::array<QString, TOOL_TYPE_COUNT> map;
33 map[PENCIL] =
tr(
"Pencil");
34 map[ERASER] =
tr(
"Eraser");
35 map[SELECT] =
tr(
"Select");
36 map[MOVE] =
tr(
"Move");
37 map[HAND] =
tr(
"Hand");
38 map[SMUDGE] =
tr(
"Smudge");
40 map[POLYLINE] =
tr(
"Polyline");
41 map[BUCKET] =
tr(
"Bucket");
42 map[EYEDROPPER] =
tr(
"Eyedropper");
43 map[BRUSH] =
tr(
"Brush");
50 mPropertyEnabled.insert(WIDTH,
false);
51 mPropertyEnabled.insert(FEATHER,
false);
52 mPropertyEnabled.insert(USEFEATHER,
false);
53 mPropertyEnabled.insert(PRESSURE,
false);
54 mPropertyEnabled.insert(INVISIBILITY,
false);
55 mPropertyEnabled.insert(PRESERVEALPHA,
false);
56 mPropertyEnabled.insert(BEZIER,
false);
57 mPropertyEnabled.insert(CLOSEDPATH,
false);
58 mPropertyEnabled.insert(ANTI_ALIASING,
false);
59 mPropertyEnabled.insert(FILL_MODE,
false);
60 mPropertyEnabled.insert(STABILIZATION,
false);
61 mPropertyEnabled.insert(CAMERAPATH,
false);
71 for (
auto& connection : mActiveConnections) {
73 mActiveConnections.removeOne(connection);
81void BaseTool::initialize(
Editor* editor)
85 mScribbleArea = editor->getScribbleArea();
86 Q_ASSERT(mScribbleArea);
106void BaseTool::pointerDoubleClickEvent(
PointerEvent* event)
108 pointerPressEvent(
event);
118 if (type() == ToolType::HAND || type() == ToolType::MOVE || type() == ToolType::CAMERA || type() == ToolType::SELECT )
130void BaseTool::setWidth(
const qreal width)
132 properties.width = width;
135void BaseTool::setFeather(
const qreal feather)
137 properties.feather = feather;
140void BaseTool::setUseFeather(
const bool usingFeather)
142 properties.useFeather = usingFeather;
145void BaseTool::setInvisibility(
const bool invisibility)
147 properties.invisibility = invisibility;
150void BaseTool::setBezier(
const bool _bezier_state)
152 properties.bezier_state = _bezier_state;
155void BaseTool::setClosedPath(
const bool closed)
157 properties.closedPolylinePath = closed;
160void BaseTool::setPressure(
const bool pressure)
162 properties.pressure = pressure;
165void BaseTool::setPreserveAlpha(
const bool preserveAlpha)
167 properties.preserveAlpha = preserveAlpha;
170void BaseTool::setVectorMergeEnabled(
const bool vectorMergeEnabled)
172 properties.vectorMergeEnabled = vectorMergeEnabled;
175void BaseTool::setAA(
const int useAA)
177 properties.useAA = useAA;
180void BaseTool::setFillMode(
const int mode)
182 properties.fillMode = mode;
185void BaseTool::setStabilizerLevel(
const int level)
187 properties.stabilizerLevel = level;
190void BaseTool::setTolerance(
const int tolerance)
192 properties.tolerance = tolerance;
195void BaseTool::setToleranceEnabled(
const bool enabled)
197 properties.toleranceEnabled = enabled;
200void BaseTool::setFillExpand(
const int fillExpandValue)
202 properties.bucketFillExpand = fillExpandValue;
205void BaseTool::setFillReferenceMode(
int referenceMode)
207 properties.bucketFillReferenceMode = referenceMode;
210void BaseTool::setFillExpandEnabled(
const bool enabled)
212 properties.bucketFillExpandEnabled = enabled;
215void BaseTool::setUseFillContour(
const bool useFillContour)
217 properties.useFillContour = useFillContour;
220void BaseTool::setShowSelectionInfo(
const bool b)
222 properties.showSelectionInfo = b;
225void BaseTool::setShowCameraPath(
const bool showCameraPath)
227 properties.cameraShowPath = showCameraPath;
230void BaseTool::setPathDotColorType(
const DotColorType dotColorType)
232 properties.cameraPathDotColorType = dotColorType;
235void BaseTool::resetCameraPath()
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
virtual bool event(QEvent *e)
QString tr(const char *sourceText, const char *disambiguation, int n)