RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
qpropertyeditorwidget.cpp
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 
24 #include "QPropertyEditorWidget.h"
25 #include "QPropertyModel.h"
26 #include "QVariantDelegate.h"
27 #include "Property.h"
28 
29 QPropertyEditorWidget::QPropertyEditorWidget(QWidget* parent /*= 0*/) : QTreeView(parent)
30 {
31  m_currentObject = NULL;
32  m_model = new QPropertyModel(this);
33  setModel(m_model);
34  setItemDelegate(new QVariantDelegate(this));
35  setEditTriggers(AllEditTriggers);
36  setSelectionBehavior(SelectItems);
37 }
38 
40 {
41 }
42 
43 void QPropertyEditorWidget::addObject(QObject* propertyObject)
44 {
45  m_model->addItem(propertyObject);
46  m_currentObject = propertyObject;
47  expandAll();
48 }
49 
50 void QPropertyEditorWidget::setObject(QObject* propertyObject)
51 {
52  m_model->clear();
53  if (propertyObject)
54  addObject(propertyObject);
55 }
56 
57 void QPropertyEditorWidget::updateObject(QObject* propertyObject)
58 {
59  if (propertyObject)
60  m_model->updateItem(propertyObject);
61 }
62 
64 {
65  updateObject(m_currentObject);
66 }
67 
69 {
70  m_model->registerCustomPropertyCB(callback);
71 }
72 
74 {
75  m_model->unregisterCustomPropertyCB(callback);
76 }
void unregisterCustomPropertyCB(QPropertyEditorWidget::UserTypeCB callback)
void registerCustomPropertyCB(QPropertyEditorWidget::UserTypeCB callback)
virtual ~QPropertyEditorWidget()
Destructor.
void registerCustomPropertyCB(UserTypeCB callback)
void unregisterCustomPropertyCB(UserTypeCB callback)
void addObject(QObject *propertyObject)
void updateItem(QObject *propertyObject, const QModelIndex &parent=QModelIndex())
QPropertyEditorWidget(QWidget *parent=0)
Constructor.
void setObject(QObject *propertyObject)
void addItem(QObject *propertyObject)