Seamly2D
Code documentation
vemptyproperty.h
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file vemptyproperty.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 VEMPTYPROPERTY_H
22 #define VEMPTYPROPERTY_H
23 
24 #include <qcompilerdetection.h>
25 #include <QMetaObject>
26 #include <QObject>
27 #include <QString>
28 #include <QStyleOptionViewItem>
29 #include <QVariant>
30 #include <Qt>
31 #include <QtGlobal>
32 
33 #include "../vproperty.h"
34 
35 namespace VPE
36 {
37 class VPropertyPrivate;
38 } // namespace VPE
39 
40 namespace VPE
41 {
42 
43 class VEmptyProperty : public VProperty
44 {
45  Q_OBJECT
46 public:
47  //! Standard constructor, takes a name and a parent property as argument
48  explicit VEmptyProperty(const QString& name);
49 
50  //! Destructor
51  virtual ~VEmptyProperty() Q_DECL_OVERRIDE;
52 
53  //! Get the data how it should be displayed
54  virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
55 
56  //! Returns an editor widget, or NULL if it doesn't supply one
57  //! \param parent The widget to which the editor will be added as a child
58  //! \options Render options
59  //! \delegate A pointer to the QAbstractItemDelegate requesting the editor. This can be used to connect signals and
60  //! slots.
61  virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& options,
62  const QAbstractItemDelegate* delegate) Q_DECL_OVERRIDE;
63 
64  //! Gets the data from the widget
65  virtual QVariant getEditorData(const QWidget* editor) const Q_DECL_OVERRIDE;
66 
67  //! Returns item flags
68  virtual Qt::ItemFlags flags(int column = DPC_Name) const Q_DECL_OVERRIDE;
69 
70  //! Returns a string containing the type of the property
71  virtual QString type() const Q_DECL_OVERRIDE;
72 
73  //! Clones this property
74  //! \param include_children Indicates whether to also clone the children
75  //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
76  //! to fill all the data into container. This can also be used when subclassing this function.
77  //! \return Returns the newly created property (or container, if it was not NULL)
78  Q_REQUIRED_RESULT virtual VProperty* clone(bool include_children = true,
79  VProperty* container = nullptr) const Q_DECL_OVERRIDE;
80 
81 protected:
82  //! Protected constructor
83  explicit VEmptyProperty(VPropertyPrivate* d);
84 
85 private:
86  Q_DISABLE_COPY(VEmptyProperty)
87 };
88 
89 }
90 
91 #endif // VEMPTYPROPERTY_H
virtual QVariant getEditorData(const QWidget *editor) const Q_DECL_OVERRIDE
Gets the data from the widget.
VEmptyProperty(const QString &name)
Standard constructor, takes a name and a parent property as argument.
virtual Qt::ItemFlags flags(int column=DPC_Name) const Q_DECL_OVERRIDE
Returns item flags.
virtual Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const Q_DECL_OVERRIDE
Clones this property.
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const Q_DECL_OVERRIDE
Get the data how it should be displayed.
virtual ~VEmptyProperty() Q_DECL_OVERRIDE
Destructor.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &options, const QAbstractItemDelegate *delegate) Q_DECL_OVERRIDE
Returns an editor widget, or NULL if it doesn't supply one.