Seamly2D
Code documentation
vpointfproperty.h
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file vpointfproperty.h
4  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
5  ** @date 27 8, 2014
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 VPOINTFPROPERTY_H
22 #define VPOINTFPROPERTY_H
23 
24 #include <qcompilerdetection.h>
25 #include <QMetaObject>
26 #include <QObject>
27 #include <QPointF>
28 #include <QString>
29 #include <QVariant>
30 #include <Qt>
31 #include <QtGlobal>
32 
33 #include "../vproperty.h"
34 
35 namespace VPE
36 {
37 
38 class VPointFProperty : public VProperty
39 {
40  Q_OBJECT
41 public:
42  explicit VPointFProperty(const QString &name);
43 
44  virtual ~VPointFProperty() Q_DECL_OVERRIDE {}
45 
46  //! Get the data how it should be displayed
47  virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
48 
49  //! Returns item flags
50  Qt::ItemFlags flags(int column = DPC_Name) const Q_DECL_OVERRIDE;
51 
52  //! Returns the QPointF
53  virtual QPointF getPointF() const;
54 
55  //! Sets the QPointF
56  virtual void setPointF(const QPointF &point);
57 
58  //! Sets the QPointF
59  virtual void setPointF(qreal x, qreal y);
60 
61  //! Returns a string containing the type of the property
62  virtual QString type() const Q_DECL_OVERRIDE;
63 
64  //! Clones this property
65  //! \param include_children Indicates whether to also clone the children
66  //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
67  //! to fill all the data into container. This can also be used when subclassing this function.
68  //! \return Returns the newly created property (or container, if it was not NULL)
69  Q_REQUIRED_RESULT virtual VProperty *clone(bool include_children = true,
70  VProperty *container = nullptr) const Q_DECL_OVERRIDE;
71 
72  //! Sets the value of the property
73  virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE;
74 
75  //! Returns the value of the property as a QVariant
76  virtual QVariant getValue() const Q_DECL_OVERRIDE;
77 
78 private:
79  Q_DISABLE_COPY(VPointFProperty)
80 };
81 
82 }
83 
84 #endif // VPOINTFPROPERTY_H
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const Q_DECL_OVERRIDE
Get the data how it should be displayed.
Qt::ItemFlags flags(int column=DPC_Name) const Q_DECL_OVERRIDE
Returns item flags.
VPointFProperty(const QString &name)
virtual QVariant getValue() const Q_DECL_OVERRIDE
Returns the value of the property as a QVariant.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
virtual ~VPointFProperty() Q_DECL_OVERRIDE
virtual QPointF getPointF() const
Returns the QPointF.
virtual void setPointF(const QPointF &point)
Sets the QPointF.
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
virtual Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const Q_DECL_OVERRIDE
Clones this property.