Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShape_p.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2009 Thomas Zander <zander@kde.org>
3 * SPDX-FileCopyrightText: 2010 Boudewijn Rempt <boud@valdyas.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7#ifndef KOSHAPEPRIVATE_H
8#define KOSHAPEPRIVATE_H
9
10#include "KoShape.h"
11
12#include <QPoint>
13#include <QPaintDevice>
14#include <QTransform>
15#include <QScopedPointer>
16#include <QSharedData>
17
18#include <KoClipMask.h>
19
20class KoShapeManager;
21
22
23class KoShape::SharedData : public QSharedData
24{
25public:
26 explicit SharedData();
27 virtual ~SharedData();
28
29 explicit SharedData(const SharedData &rhs);
30
31
32public:
33 // Members
34
35 mutable QSizeF size; // size in pt
36 QString shapeId;
37 QString name;
38
39 QTransform localMatrix;
40
41 QScopedPointer<KoShapeUserData> userData;
44 bool inheritBackground = false;
45 bool inheritStroke = false;
46 // XXX: change this to instance instead of pointer
47 QScopedPointer<KoClipPath> clipPath;
48 QScopedPointer<KoClipMask> clipMask;
49 QMap<QString, QString> additionalAttributes;
50 QMap<QByteArray, QString> additionalStyleAttributes;
52 QString hyperLink; //hyperlink for this shape
53
54 int zIndex : 16; // keep maxZIndex in sync!
55 int visible : 1;
56 int printable : 1;
58 int keepAspect : 1;
59 int selectable : 1;
61
63 bool inheritPaintOrder = true;
64};
65
67{
68private:
74 {
79
80 void notifyShapeChanged(KoShape::ChangeType type, KoShape *shape) override {
81 if (type == KoShape::Deleted && m_dependees.contains(shape)) {
82 m_dependees.removeOne(shape);
83 // the listener will be unlinked on destruction automatically
84 }
85 }
86
87 private:
89 };
90
91public:
93 Private(const Private &rhs) = delete;
94
96 QSet<KoShapeManager *> shapeManagers;
97 QSet<KoShape *> toolDelegates;
101};
102
103#endif
QSet< KoShapeManager * > shapeManagers
Definition KoShape_p.h:96
QList< KoShape::ShapeChangeListener * > listeners
Definition KoShape_p.h:99
KoShapeContainer * parent
Definition KoShape_p.h:95
QSet< KoShape * > toolDelegates
Definition KoShape_p.h:97
Private(const Private &rhs)=delete
QList< KoShape * > dependees
list of shape dependent on this shape
Definition KoShape_p.h:98
DependeesLifetimeListener dependeesLifetimeListener
Definition KoShape_p.h:100
qreal transparency
the shapes transparency
Definition KoShape_p.h:51
QMap< QByteArray, QString > additionalStyleAttributes
Definition KoShape_p.h:50
QString name
the shapes names
Definition KoShape_p.h:37
virtual ~SharedData()
Definition KoShape.cpp:100
QVector< PaintOrder > paintOrder
Definition KoShape_p.h:62
QScopedPointer< KoClipMask > clipMask
the current clip mask
Definition KoShape_p.h:48
QScopedPointer< KoShapeUserData > userData
Definition KoShape_p.h:41
QMap< QString, QString > additionalAttributes
Definition KoShape_p.h:49
QSharedPointer< KoShapeBackground > fill
Stands for the background color / fill etc.
Definition KoShape_p.h:43
QTransform localMatrix
the shapes local transformation matrix
Definition KoShape_p.h:39
QScopedPointer< KoClipPath > clipPath
the current clip path
Definition KoShape_p.h:47
QSharedPointer< KoShapeStrokeModel > stroke
points to a stroke, or 0 if there is no stroke
Definition KoShape_p.h:42
ChangeType
Used by shapeChanged() to select which change was made.
Definition KoShape.h:92
@ Deleted
the shape was deleted
Definition KoShape.h:101
@ Stroke
Definition KoShape.h:117
@ Markers
Definition KoShape.h:118
DependeesLifetimeListener(QList< KoShape * > &dependees)
Definition KoShape_p.h:75
void notifyShapeChanged(KoShape::ChangeType type, KoShape *shape) override
Definition KoShape_p.h:80