itom  4.1.0
QPropertyEditorWidget.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 QPROPERTYEDITORWIDGET_H_
26 #define QPROPERTYEDITORWIDGET_H_
27 
28 #include <qtreeview.h>
29 
30 class QPropertyModel;
31 class Property;
32 
56 class QPropertyEditorWidget : public QTreeView
57 {
58  Q_OBJECT
59 public:
60 
64  typedef Property* (*UserTypeCB)(const QString& name, QObject* propertyObject, Property* parent);
65 
72  QPropertyEditorWidget(QWidget* parent = 0);
73 
75  virtual ~QPropertyEditorWidget();
76 
83  void addObject(QObject* propertyObject);
84 
93  void setObject(QObject* propertyObject);
94 
100  void updateObject(QObject* propertyObject);
101 
107  void registerCustomPropertyCB(UserTypeCB callback);
108 
113  void unregisterCustomPropertyCB(UserTypeCB callback);
114 
115  void setSorted(bool value);
116 
117  bool sorted() const;
118 
119 protected:
120  void mousePressEvent(QMouseEvent *event);
121  void keyPressEvent(QKeyEvent *event);
122 
123 private:
126 
127  bool m_sorted;
128 
129 
130 };
131 #endif
QPropertyModel * m_model
The Model for this view.
Definition: QPropertyEditorWidget.h:129
virtual ~QPropertyEditorWidget()
Destructor.
Definition: QPropertyEditorWidget.cpp:61
void registerCustomPropertyCB(UserTypeCB callback)
Definition: QPropertyEditorWidget.cpp:89
Definition: QPropertyModel.h:38
The QPropertyEditorWidget offers an easy to use mechanism to visualize properties of a class inherite...
Definition: QPropertyEditorWidget.h:60
void updateObject(QObject *propertyObject)
Definition: QPropertyEditorWidget.cpp:83
void unregisterCustomPropertyCB(UserTypeCB callback)
Definition: QPropertyEditorWidget.cpp:94
void addObject(QObject *propertyObject)
Definition: QPropertyEditorWidget.cpp:65
QPropertyEditorWidget(QWidget *parent=0)
Constructor.
Definition: QPropertyEditorWidget.cpp:36
Definition: Property.h:40
Property *(* UserTypeCB)(const QString &name, QObject *propertyObject, Property *parent)
Definition: QPropertyEditorWidget.h:68
void setObject(QObject *propertyObject)
Definition: QPropertyEditorWidget.cpp:74