Krita Source Code Documentation
Loading...
Searching...
No Matches
KisToolOutlineBase.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2000 John Califf <jcaliff@compuzone.net>
3 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
4 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org>
5 * SPDX-FileCopyrightText: 2015 Michael Abrahams <miabraha@gmail.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10#ifndef KISTOOLOUTLINEBASE_H
11#define KISTOOLOUTLINEBASE_H
12
13#include <kis_tool_shape.h>
14#include <kis_cursor.h>
15
17
18class KRITAUI_EXPORT KisToolOutlineBase : public KisToolShape
19{
20 Q_OBJECT
21
22public:
23 enum ToolType {
25 SELECT
26 };
27
29 ToolType type,
30 const QCursor & cursor=KisCursor::load("tool_outline_selection_cursor.png", 6, 6));
31 ~KisToolOutlineBase() override;
32
33 void beginPrimaryAction(KoPointerEvent *event) override;
34 void continuePrimaryAction(KoPointerEvent *event) override;
35 void endPrimaryAction(KoPointerEvent *event) override;
36 void paint(QPainter& gc, const KoViewConverter &converter) override;
37
38 void keyPressEvent(QKeyEvent *event) override;
39 void keyReleaseEvent(QKeyEvent *event) override;
40 void mouseMoveEvent(KoPointerEvent *event) override;
41 bool eventFilter(QObject *obj, QEvent *event) override;
43
44 bool hasUserInteractionRunning() const;
45
46public Q_SLOTS:
47 void activate(const QSet<KoShape*> &shapes) override;
48 void deactivate() override;
49 void requestStrokeEnd() override;
50 void requestStrokeCancellation() override;
51
52 void undoLastPoint();
53
54protected:
55 virtual void finishOutline(const QVector<QPointF>& points) = 0;
56
57private:
58 static constexpr int FEEDBACK_LINE_WIDTH{2};
59
60 QPainterPath m_paintPath;
67 QScopedPointer<KisInputActionGroupsMaskGuard> m_blockModifyingActionsGuard;
68
69 void updateFeedback();
70 void updateContinuedMode();
72 void endStroke();
73 void cancelStroke();
74 QRectF dragBoundingRect();
75 void installBlockActionGuard();
76 void uninstallBlockActionGuard();
77
78};
79
80#endif
#define FEEDBACK_LINE_WIDTH
static QCursor load(const QString &cursorName, int hotspotX=-1, int hotspotY=-1)
The PopupWidgetInterface abstract class defines the basic interface that will be used by all popup wi...
QScopedPointer< KisInputActionGroupsMaskGuard > m_blockModifyingActionsGuard
QVector< QPointF > m_points
virtual void finishOutline(const QVector< QPointF > &points)=0
void deactivate() override
void paint(QPainter &gc, const KoViewConverter &converter) override
KisPopupWidgetInterface * popupWidget() override
void mouseMoveEvent(KoPointerEvent *event) override
void activate(const QSet< KoShape * > &shapes) override
virtual void requestStrokeCancellation()
virtual void keyReleaseEvent(QKeyEvent *event)
virtual void keyPressEvent(QKeyEvent *event)
virtual void requestStrokeEnd()
virtual void beginPrimaryAction(KoPointerEvent *event)
Definition kis_tool.cc:431
virtual void endPrimaryAction(KoPointerEvent *event)
Definition kis_tool.cc:446
virtual void continuePrimaryAction(KoPointerEvent *event)
Definition kis_tool.cc:441