Krita

GroupShape.cpp
1 /*
2  * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 #include "GroupShape.h"
7 #include <KoShapeGroup.h>
8 
9 GroupShape::GroupShape(QObject *parent) : Shape(new KoShapeGroup(), parent)
10 {
11 }
12 
13 GroupShape::GroupShape(KoShapeGroup *shape, QObject *parent) :
14  Shape(shape, parent)
15 {
16 
17 }
18 
19 GroupShape::~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 }
The Shape class The shape class is a wrapper around Krita's vector objects.
Definition: Shape.h:37
QList< Shape * > children()
children
Definition: GroupShape.cpp:30
const T & at(int i) const const
QList::iterator begin()
QList::iterator end()
QString type() const override
type returns the type.
Definition: GroupShape.cpp:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 04:09:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.