Krita Source Code Documentation
Loading...
Searching...
No Matches
KoToolBase_p.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2010 Thomas Zander <zander@kde.org>
3 * SPDX-FileCopyrightText: 2010 Halla Rempt <halla@valdyas.org>
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KOTOOLBASE_P_H
8#define KOTOOLBASE_P_H
9
12#include "KoCanvasBase.h"
13#include "KoShapeController.h"
14#include <QHash>
15#include <QWidget>
16#include <QPointer>
17#include <string.h> // for the qt version check
18
19class QAction;
20class KoToolBase;
22
24{
25public:
27 : currentCursor(Qt::ArrowCursor),
28 q(qq),
29 canvas(canvas_),
30 isInTextMode(false),
31 isActivated(false)
32 {
33 }
34
36 {
37 Q_FOREACH (QPointer<QWidget> optionWidget, optionWidgets) {
38 if (optionWidget) {
39 optionWidget->setParent(0);
40 delete optionWidget;
41 }
42 }
43 optionWidgets.clear();
44 }
45
47 {
48 if (canvas) { // in the case of KoToolManagers dummy tool it can be zero :(
50 Q_ASSERT_X(crp, "KoToolBase::KoToolBase", "No Canvas KoResourceManager");
51 if (crp)
52 q->connect(crp, SIGNAL(canvasResourceChanged(int, const QVariant &)),
53 SLOT(canvasResourceChanged(int, const QVariant &)));
54
55 KoDocumentResourceManager *scrm = canvas->shapeController()->resourceManager();
56 if (scrm) {
57 q->connect(scrm, SIGNAL(resourceChanged(int, const QVariant &)),
58 SLOT(documentResourceChanged(int, const QVariant &)));
59 }
60 }
61 }
62
64 QHash<int, KoAbstractCanvasResourceInterfaceSP> abstractResources;
65 QHash<int, KoDerivedResourceConverterSP> converters;
66 };
67
75 bool maskSyntheticEvents{false};
78 bool isOpacityPresetMode{false};
80
81};
82
83#endif
QPointer< KoShapeController > shapeController
QPointer< KoCanvasResourceProvider > resourceManager
ToolCanvasResources toolCanvasResources
KoToolBase * q
KoToolBasePrivate(KoToolBase *qq, KoCanvasBase *canvas_)
KoCanvasBase * canvas
the canvas interface this tool will work for.
KoToolFactoryBase * factory
QRectF lastDecorationsRect
bool isOpacityPresetMode
Whether the opacity is preset or tool.
virtual ~KoToolBasePrivate()
QList< QPointer< QWidget > > optionWidgets
the optionwidgets associated with this tool
bool maskSyntheticEvents
Whether this tool masks synthetic events.
QHash< int, KoDerivedResourceConverterSP > converters
QHash< int, KoAbstractCanvasResourceInterfaceSP > abstractResources