Krita

GroupShape.cpp
1/*
2 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#include "GroupShape.h"
7#include <KoShapeGroup.h>
8
9GroupShape::GroupShape(QObject *parent) : Shape(new KoShapeGroup(), parent)
10{
11}
12
13GroupShape::GroupShape(KoShapeGroup *shape, QObject *parent) :
14 Shape(shape, parent)
15{
16
17}
18
19GroupShape::~GroupShape()
20{
21
22}
23
25{
26 //Has no default KoID
27 return "groupshape";
28}
29
31{
32 KoShapeGroup * group = dynamic_cast<KoShapeGroup*>(this->shape());
33 QList <Shape*> shapes;
34 if (group) {
35 QList<KoShape*> originalShapes = group->shapes();
36 std::sort(originalShapes.begin(), originalShapes.end(), KoShape::compareShapeZIndex);
37 for(int i=0; i<group->shapeCount(); i++) {
38 if (dynamic_cast<KoShapeGroup*>(originalShapes.at(i))) {
39 shapes << new GroupShape(dynamic_cast<KoShapeGroup*>(originalShapes.at(i)));
40 } else {
41 shapes << new Shape(originalShapes.at(i));
42 }
43 }
44 }
45 return shapes;
46}
QString type() const override
type returns the type.
QList< Shape * > children()
children
The Shape class The shape class is a wrapper around Krita's vector objects.
Definition Shape.h:38
const_reference at(qsizetype i) const const
iterator begin()
iterator end()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:55:54 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.