diff options
Diffstat (limited to 'utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditorWidget.cpp')
-rw-r--r-- | utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditorWidget.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditorWidget.cpp b/utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditorWidget.cpp new file mode 100644 index 0000000000..fc4b90c227 --- /dev/null +++ b/utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditorWidget.cpp | |||
@@ -0,0 +1,56 @@ | |||
1 | // ************************************************************************************************* | ||
2 | // | ||
3 | // QPropertyEditor v 0.1 | ||
4 | // | ||
5 | // -------------------------------------- | ||
6 | // Copyright (C) 2007 Volker Wiendl | ||
7 | // | ||
8 | // | ||
9 | // This library is free software; you can redistribute it and/or | ||
10 | // modify it under the terms of the GNU Lesser General Public | ||
11 | // License as published by the Free Software Foundation; either | ||
12 | // version 2.1 of the License, or any later version. | ||
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 | // You should have received a copy of the GNU Lesser General Public | ||
20 | // License along with this library; if not, write to the Free Software | ||
21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | // | ||
23 | // ************************************************************************************************* | ||
24 | |||
25 | #include "QPropertyEditorWidget.h" | ||
26 | #include "QPropertyModel.h" | ||
27 | #include "QVariantDelegate.h" | ||
28 | #include "Property.h" | ||
29 | |||
30 | QPropertyEditorWidget::QPropertyEditorWidget(QWidget* parent /*= 0*/) : QTreeView(parent) { | ||
31 | m_model = new QPropertyModel(this); | ||
32 | setModel(m_model); | ||
33 | setItemDelegate(new QVariantDelegate(this)); | ||
34 | } | ||
35 | |||
36 | |||
37 | QPropertyEditorWidget::~QPropertyEditorWidget() {} | ||
38 | |||
39 | void QPropertyEditorWidget::addObject(QObject* propertyObject) { | ||
40 | m_model->addItem(propertyObject); | ||
41 | expandToDepth(0); | ||
42 | } | ||
43 | |||
44 | void QPropertyEditorWidget::setObject(QObject* propertyObject) { | ||
45 | m_model->clear(); | ||
46 | if (propertyObject) | ||
47 | addObject(propertyObject); | ||
48 | } | ||
49 | |||
50 | void QPropertyEditorWidget::updateObject(QObject* propertyObject) { | ||
51 | m_model->updateItem(propertyObject); | ||
52 | } | ||
53 | |||
54 | void QPropertyEditorWidget::setCustomPropertyCB(UserTypeCB callback) { | ||
55 | m_model->setCustomPropertyCB(callback); | ||
56 | } | ||