Seamly2D
Code documentation
vstandardpropertyfactory.cpp
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file vstandardpropertyfactory.cpp
4  ** @author hedgeware <internal(at)hedgeware.net>
5  ** @date
6  **
7  ** @brief
8  ** @copyright
9  ** All rights reserved. This program and the accompanying materials
10  ** are made available under the terms of the GNU Lesser General Public License
11  ** (LGPL) version 2.1 which accompanies this distribution, and is available at
12  ** http://www.gnu.org/licenses/lgpl-2.1.html
13  **
14  ** This library is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  ** Lesser General Public License for more details.
18  **
19  *************************************************************************/
20 
22 
23 #include "vproperty.h"
25 #include "plugins/vboolproperty.h"
26 #include "plugins/vcolorproperty.h"
27 #include "plugins/vemptyproperty.h"
28 #include "plugins/venumproperty.h"
29 #include "plugins/vfileproperty.h"
33 
36 {
37 }
38 
41 {
42  if (manager)
43  {
44  manager->registerFactory("string", this);
45  manager->registerFactory("bool", this);
46  manager->registerFactory("color", this);
47  manager->registerFactory("empty", this);
48  manager->registerFactory("enum", this);
49  manager->registerFactory("file", this);
50  manager->registerFactory("integer", this);
51  manager->registerFactory("double", this);
52  manager->registerFactory("shortcut", this);
53  manager->registerFactory("vector3d", this);
54  }
55 }
56 
57 VPE::VProperty *VPE::VStandardPropertyFactory::createProperty(const QString &type, const QString &name)
58 {
59  if (type == QString("string"))
60  {
61  return new VProperty(name);
62  }
63  else if (type == QString("bool"))
64  {
65  return new VBoolProperty(name);
66  }
67  else if (type == QString("color"))
68  {
69  return new VColorProperty(name);
70  }
71  else if (type == QString("empty"))
72  {
73  return new VEmptyProperty(name);
74  }
75  else if (type == QString("enum"))
76  {
77  return new VEnumProperty(name);
78  }
79  else if (type == QString("file"))
80  {
81  return new VFileProperty(name);
82  }
83  else if (type == QString("integer"))
84  {
85  return new SpinboxProperty(name);
86  }
87  else if (type == QString("double"))
88  {
89  return new DoubleSpinboxProperty(name);
90  }
91  else if (type == QString("shortcut"))
92  {
93  return new VShortcutProperty(name);
94  }
95  else if (type == QString("vector3d"))
96  {
97  return new QVector3DProperty(name);
98  }
99  else
100  return nullptr;
101 }
Class for holding a double property.
Class for holding an integer property.
The VBoolProperty can take two states: True or False.
Definition: vboolproperty.h:40
void registerFactory(const QString &type, VAbstractPropertyFactory *factory)
Register a factory to the factory manager Note that the manager takes ownership of the factory,...
This property can be used to handle key shortcuts.
virtual Q_REQUIRED_RESULT VProperty * createProperty(const QString &type, const QString &name) Q_DECL_OVERRIDE
Creates a new property of a certain type and assigns a name and description (otionally)