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(ANTI_ALIASING,
false);
58 mPropertyEnabled.insert(FILL_MODE,
false);
59 mPropertyEnabled.insert(STABILIZATION,
false);
60 mPropertyEnabled.insert(CAMERAPATH,
false);
70 for (
auto& connection : mActiveConnections) {
72 mActiveConnections.removeOne(connection);
77void BaseTool::initialize(
Editor* editor)
81 mScribbleArea = editor->getScribbleArea();
82 Q_ASSERT(mScribbleArea);
102void BaseTool::pointerDoubleClickEvent(
PointerEvent* event)
104 pointerPressEvent(
event);
114 if (type() == ToolType::HAND || type() == ToolType::MOVE || type() == ToolType::CAMERA || type() == ToolType::SELECT )
126void BaseTool::setWidth(
const qreal width)
128 properties.width = width;
131void BaseTool::setFeather(
const qreal feather)
133 properties.feather = feather;
136void BaseTool::setUseFeather(
const bool usingFeather)
138 properties.useFeather = usingFeather;
141void BaseTool::setInvisibility(
const bool invisibility)
143 properties.invisibility = invisibility;
146void BaseTool::setBezier(
const bool _bezier_state)
148 properties.bezier_state = _bezier_state;
151void BaseTool::setPressure(
const bool pressure)
153 properties.pressure = pressure;
156void BaseTool::setPreserveAlpha(
const bool preserveAlpha)
158 properties.preserveAlpha = preserveAlpha;
161void BaseTool::setVectorMergeEnabled(
const bool vectorMergeEnabled)
163 properties.vectorMergeEnabled = vectorMergeEnabled;
166void BaseTool::setAA(
const int useAA)
168 properties.useAA = useAA;
171void BaseTool::setFillMode(
const int mode)
173 properties.fillMode = mode;
176void BaseTool::setStabilizerLevel(
const int level)
178 properties.stabilizerLevel = level;
181void BaseTool::setTolerance(
const int tolerance)
183 properties.tolerance = tolerance;
186void BaseTool::setToleranceEnabled(
const bool enabled)
188 properties.toleranceEnabled = enabled;
191void BaseTool::setFillExpand(
const int fillExpandValue)
193 properties.bucketFillExpand = fillExpandValue;
196void BaseTool::setFillReferenceMode(
int referenceMode)
198 properties.bucketFillReferenceMode = referenceMode;
201void BaseTool::setFillExpandEnabled(
const bool enabled)
203 properties.bucketFillExpandEnabled = enabled;
206void BaseTool::setUseFillContour(
const bool useFillContour)
208 properties.useFillContour = useFillContour;
211void BaseTool::setShowSelectionInfo(
const bool b)
213 properties.showSelectionInfo = b;
216void BaseTool::setShowCameraPath(
const bool showCameraPath)
218 properties.cameraShowPath = showCameraPath;
221void BaseTool::setPathDotColorType(
const DotColorType dotColorType)
223 properties.cameraPathDotColorType = dotColorType;
226void 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)