Seamly2D
Code documentation
vvector3dproperty.h
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file vvector3dproperty.h
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 
21 #ifndef VVECTOR3DPROPERTY_H
22 #define VVECTOR3DPROPERTY_H
23 
24 #include <qcompilerdetection.h>
25 #include <stddef.h>
26 #include <QMetaObject>
27 #include <QObject>
28 #include <QString>
29 #include <QVariant>
30 #include <Qt>
31 #include <QtGlobal>
32 
33 #include "../../vproperty.h"
34 
35 namespace VPE
36 {
37 
38 struct Vector3D //-V690
39 {
40 public:
42  :X(0), Y(0), Z(0)
43  {}
44 
45  Vector3D(const Vector3D& other)
46  :X(other.X), Y(other.Y), Z(other.Z)
47  {}
48 
49  Vector3D &operator=(const Vector3D &other)
50  {
51  if ( &other == this )
52  {
53  return *this;
54  }
55  X = other.X;
56  Y = other.Y;
57  Z = other.Z;
58  return *this;
59  }
60 
61  ~Vector3D() {}
62 
63  double X, Y, Z;
64 };
65 /*
66 }
67 
68 Q_DECLARE_METATYPE(QPE::Vector3D) // todo
69 
70 */
71 
73 {
74  Q_OBJECT
75 public:
76  explicit QVector3DProperty(const QString& name);
77 
78  virtual ~QVector3DProperty() Q_DECL_OVERRIDE {}
79 
80  //! Get the data how it should be displayed
81  virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
82 
83  //! Returns item flags
84  virtual Qt::ItemFlags flags(int column = DPC_Name) const Q_DECL_OVERRIDE;
85 
86  //! Returns the Vector3d
87  virtual Vector3D getVector() const;
88 
89  //! Sets the Vector3d
90  virtual void setVector(const Vector3D& vect);
91 
92  //! Sets the Vector3d
93  virtual void setVector(double x, double y, double z);
94 
95  //! Returns a string containing the type of the property
96  virtual QString type() const Q_DECL_OVERRIDE;
97 
98  //! Clones this property
99  //! \param include_children Indicates whether to also clone the children
100  //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
101  //! to fill all the data into container. This can also be used when subclassing this function.
102  //! \return Returns the newly created property (or container, if it was not NULL)
103  virtual VProperty* clone(bool include_children = true, VProperty* container = NULL) const Q_DECL_OVERRIDE;
104 
105  //! Sets the value of the property
106  virtual void setValue(const QVariant& value) Q_DECL_OVERRIDE;
107 
108  //! Returns the value of the property as a QVariant
109  virtual QVariant getValue() const Q_DECL_OVERRIDE;
110 
111 private:
112  Q_DISABLE_COPY(QVector3DProperty)
113 };
114 
115 }
116 
117 #endif // VVECTOR3DPROPERTY_H
virtual Vector3D getVector() const
Returns the Vector3d.
virtual ~QVector3DProperty() Q_DECL_OVERRIDE
virtual Qt::ItemFlags flags(int column=DPC_Name) const Q_DECL_OVERRIDE
Returns item flags.
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
virtual QVariant getValue() const Q_DECL_OVERRIDE
Returns the value of the property as a QVariant.
virtual void setVector(const Vector3D &vect)
Sets the Vector3d.
QVector3DProperty(const QString &name)
virtual VProperty * clone(bool include_children=true, VProperty *container=NULL) const Q_DECL_OVERRIDE
Clones this property.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const Q_DECL_OVERRIDE
Get the data how it should be displayed.
Vector3D(const Vector3D &other)
Vector3D & operator=(const Vector3D &other)