Seamly2D
Code documentation
vshortcutproperty.h
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file vshortcutproperty.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 VSHORTCUTROPERTY_H
22 #define VSHORTCUTROPERTY_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 
38 //! This property can be used to handle key shortcuts
40 {
41  Q_OBJECT
42 public:
43  explicit VShortcutProperty(const QString &name);
44 
45  //! The destructor
46  virtual ~VShortcutProperty() Q_DECL_OVERRIDE;
47 
48  //! Get the data how it should be displayed
49  virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
50 
51  //! Returns an editor widget, or NULL if it doesn't supply one
52  //! \param parent The widget to which the editor will be added as a child
53  //! \options Render options
54  //! \delegate A pointer to the QAbstractItemDelegate requesting the editor. This can be used to connect signals and
55  //! slots.
56  virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& options,
57  const QAbstractItemDelegate* delegate) Q_DECL_OVERRIDE;
58 
59  //! Sets the property's data to the editor (returns false, if the standard delegate should do that)
60  virtual bool setEditorData(QWidget* editor) Q_DECL_OVERRIDE;
61 
62  //! Gets the data from the widget
63  virtual QVariant getEditorData(const QWidget* editor) const Q_DECL_OVERRIDE;
64 
65  //! Returns a string containing the type of the property
66  virtual QString type() const Q_DECL_OVERRIDE;
67 
68  //! Clones this property
69  //! \param include_children Indicates whether to also clone the children
70  //! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
71  //! to fill all the data into container. This can also be used when subclassing this function.
72  //! \return Returns the newly created property (or container, if it was not NULL)
73  Q_REQUIRED_RESULT virtual VProperty* clone(bool include_children = true,
74  VProperty* container = nullptr) const Q_DECL_OVERRIDE;
75 
76  //! Sets the value of the property
77  virtual void setValue(const QVariant& value) Q_DECL_OVERRIDE;
78 
79 private:
80  Q_DISABLE_COPY(VShortcutProperty)
81 };
82 
83 }
84 
85 #endif // VFILEPROPERTY_H
This property can be used to handle key shortcuts.
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value 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.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
virtual QVariant getEditorData(const QWidget *editor) const Q_DECL_OVERRIDE
Gets the data from the widget.
virtual ~VShortcutProperty() Q_DECL_OVERRIDE
The destructor.
VShortcutProperty(const QString &name)
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 Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const Q_DECL_OVERRIDE
Clones this property.
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)