RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
qpropertymodel.h
Go to the documentation of this file.
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 General Public License as published by
12 // the Free Software Foundation version 3 of the License
13 //
14 // The Horde3D Scene Editor 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
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 //
22 // *************************************************************************************************
23 #ifndef QPROPERTYMODEL_H_
24 #define QPROPERTYMODEL_H_
25 
26 #include <QtCore/QAbstractItemModel>
27 #include <QtCore/QMap>
28 
29 #include "QPropertyEditorWidget.h"
30 
31 class Property;
32 
36 class QPropertyModel : public QAbstractItemModel
37 {
38  Q_OBJECT
39 public:
44  QPropertyModel(QObject* parent = 0);
46  virtual ~QPropertyModel();
47 
49  QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
50 
52  QModelIndex parent ( const QModelIndex & index ) const;
54  int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
56  int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
58  QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
59 
61  bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
63  Qt::ItemFlags flags ( const QModelIndex & index ) const;
64 
66  QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
67 
69  QModelIndex buddy ( const QModelIndex & index ) const;
70 
77  void addItem(QObject* propertyObject);
78 
84  void updateItem ( QObject* propertyObject, const QModelIndex& parent = QModelIndex() ) ;
85 
89  void clear();
90 
95 
100 
101 
102 private:
103 
105  void addDynamicProperties( Property* parent, QObject* propertyObject );
106 
108  Property* m_rootItem;
109 
111  QList<QPropertyEditorWidget::UserTypeCB> m_userCallbacks;
112 
113 };
114 #endif
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QAbstractItemModel implementation.
void unregisterCustomPropertyCB(QPropertyEditorWidget::UserTypeCB callback)
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
QAbstractItemModel implementation.
void registerCustomPropertyCB(QPropertyEditorWidget::UserTypeCB callback)
QModelIndex parent(const QModelIndex &index) const
QAbstractItemModel implementation.
virtual ~QPropertyModel()
Destructor.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
QAbstractItemModel implementation.
int rowCount(const QModelIndex &parent=QModelIndex()) const
QAbstractItemModel implementation.
void updateItem(QObject *propertyObject, const QModelIndex &parent=QModelIndex())
QPropertyModel(QObject *parent=0)
QModelIndex buddy(const QModelIndex &index) const
QAbstractItemModel implementation.
Property *(* UserTypeCB)(const QString &name, QObject *propertyObject, Property *parent)
int columnCount(const QModelIndex &parent=QModelIndex()) const
QAbstractItemModel implementation.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
QAbstractItemModel implementation.
Qt::ItemFlags flags(const QModelIndex &index) const
QAbstractItemModel implementation.
void addItem(QObject *propertyObject)