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