Krita Source Code Documentation
Loading...
Searching...
No Matches
KoSelection.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2
3 SPDX-FileCopyrightText: 2006 Boudewijn Rempt <boud@valdyas.org>
4 SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
5 SPDX-FileCopyrightText: 2007, 2009 Thomas Zander <zander@kde.org>
6 SPDX-FileCopyrightText: 2006, 2007 Jan Hambrecht <jaham@gmx.net>
7
8 SPDX-License-Identifier: LGPL-2.0-or-later
9*/
10
11#ifndef KOSELECTION_H
12#define KOSELECTION_H
13
14#include <QObject>
15
16#include "KoShape.h"
17#include "KoFlake.h"
18
19#include "kritaflake_export.h"
20
21class KoShapeLayer;
22class KoSelectionPrivate;
23
37class KRITAFLAKE_EXPORT KoSelection : public QObject, public KoShape, public KoShape::ShapeChangeListener
38{
39 Q_OBJECT
40
41public:
42
43 KoSelection(QObject *parent = 0);
44 ~KoSelection() override;
45
46 void paint(QPainter &painter) const override;
47 void setSize(const QSizeF &size) override;
48 QSizeF size() const override;
49 QRectF outlineRect() const override;
50 QRectF boundingRect() const override;
51
65 void select(KoShape *shape);
66
80 void deselect(KoShape *shape);
81
83 void deselectAll();
84
89 const QList<KoShape*> selectedShapes() const;
90
95 const QList<KoShape*> selectedVisibleShapes() const;
96
101 const QList<KoShape*> selectedEditableShapes() const;
102
107 const QList<KoShape*> selectedEditableShapesAndDelegates() const;
108
112 KoShape *firstSelectedShape() const;
113
115 bool isSelected(const KoShape *shape) const;
116
118 int count() const;
119
120 bool hitTest(const QPointF &position) const override;
121
126 void setActiveLayer(KoShapeLayer *layer);
127
133 KoShapeLayer *activeLayer() const;
134
135 void notifyShapeChanged(ChangeType type, KoShape *shape) override;
136
137Q_SIGNALS:
140
143
144protected:
145 KoSelection(const KoSelection &rhs);
146
147private:
148 class Private;
149 QSharedDataPointer<Private> d;
150};
151
152#endif
void currentLayerChanged(const KoShapeLayer *layer)
emitted when the current layer is changed
void selectionChanged()
emitted when the selection is changed
QSharedDataPointer< Private > d
virtual QSizeF size() const
Get the size of the shape in pt.
Definition KoShape.cpp:820
virtual QRectF outlineRect() const
Definition KoShape.cpp:637
virtual QRectF boundingRect() const
Get the bounding box of the shape.
Definition KoShape.cpp:335
virtual void paint(QPainter &painter) const =0
Paint the shape fill The class extending this one is responsible for painting itself....
ChangeType
Used by shapeChanged() to select which change was made.
Definition KoShape.h:95
virtual bool hitTest(const QPointF &position) const
Check if the shape is hit on position.
Definition KoShape.cpp:308
virtual void setSize(const QSizeF &size)
Resize the shape.
Definition KoShape.cpp:276
virtual void notifyShapeChanged(ChangeType type, KoShape *shape)=0