1 /* This file is part of StepCore library.
2 Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
3 Copyright (C) 2014 Inge Wallin <inge@lysator.liu.se>
4
5 StepCore library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 StepCore library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with StepCore; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20
21 #include "item.h"
22 #include "objecterrors.h"
23
24
25 namespace StepCore
26 {
27
28 STEPCORE_META_OBJECT(Item, QT_TRANSLATE_NOOP("ObjectClass", "Item"), QT_TRANSLATE_NOOP("ObjectDescription", "Item"),
29 MetaObject::ABSTRACT, STEPCORE_SUPER_CLASS(Object),
30 STEPCORE_PROPERTY_RW(StepCore::Color, color, QT_TRANSLATE_NOOP("PropertyName", "color"),
31 STEPCORE_UNITS_NULL, QT_TRANSLATE_NOOP("PropertyDescription", "Item color"), color, setColor))
32
operator =(const Item & item)33 Item& Item::operator=(const Item& item)
34 {
35 Object::operator=(item);
36
37 _world = item._world;
38 _group = item._group;
39
40 if(item._objectErrors) {
41 _objectErrors = static_cast<ObjectErrors*>(
42 item._objectErrors->metaObject()->cloneObject(*item._objectErrors) );
43 _objectErrors->setOwner(this);
44 } else {
45 _objectErrors = NULL;
46 }
47
48 _color = item._color;
49
50 return *this;
51 }
52
objectErrors()53 ObjectErrors* Item::objectErrors()
54 {
55 if(!_objectErrors) _objectErrors = createObjectErrors();
56 return _objectErrors;
57 }
58
59
60
61 } // namespace StepCore
62