itom  4.1.0
EnumProperty.h
1 // *************************************************************************************************
2 //
3 // QPropertyEditor v 0.3
4 //
5 // --------------------------------------
6 // Copyright (C) 2007 Volker Wiendl
7 // Acknowledgements to Roman alias banal from qt-apps.org for the Enum enhancement
8 //
9 //
10 // The QPropertyEditor Library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by the Free Software
12 // Foundation; either version 2 of the License, or (at your option) any later
13 // version.
14 //
15 // This program is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public License along with
20 // this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 // Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22 // http://www.gnu.org/copyleft/lesser.txt.
23 //
24 // *************************************************************************************************
25 #ifndef __ENUMPROPERTY_H__
26 #define __ENUMPROPERTY_H__
27 
28 #include <qstringlist.h>
29 #include <qmetaobject.h>
30 #include <qmetatype.h>
31 #include <qcombobox.h>
32 #include "Property.h"
33 
42 class EnumProperty : public Property
43 {
44  Q_OBJECT
45 
46 public:
47  EnumProperty(const QString& name = QString(), QObject* propertyObject = 0, QObject* parent = 0);
48 
50  virtual QVariant value(int role = Qt::UserRole) const;
52  virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option);
54  virtual bool setEditorData(QWidget *editor, const QVariant& data);
56  virtual QVariant editorData(QWidget *editor);
57 
58 private slots:
60  void valueChanged(const QString item);
61 
62 private:
64  QStringList m_enum;
65 };
66 #endif
void valueChanged(const QString item)
Definition: EnumProperty.cpp:127
virtual QVariant editorData(QWidget *editor)
Definition: EnumProperty.cpp:110
Definition: Property.h:40
QStringList m_enum
Definition: EnumProperty.h:64
virtual QVariant value(int role=Qt::UserRole) const
Definition: EnumProperty.cpp:50
virtual bool setEditorData(QWidget *editor, const QVariant &data)
Definition: EnumProperty.cpp:83
QObject * propertyObject()
Definition: Property.h:77
Definition: EnumProperty.h:42
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option)
Definition: EnumProperty.cpp:70