itom
Loading...
Searching...
No Matches
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#ifdef __APPLE__
29extern "C++"
30{
31#endif
32
33#include "defines.h"
34
35#include <QtWidgets/qtreeview.h>
36#include <qscopedpointer.h>
37
38 class QPropertyModel;
39 class Property;
41
66 class QPROPERTYEDITOR_EXPORT QPropertyEditorWidget : public QTreeView
67 {
68 Q_OBJECT
69
70 Q_PROPERTY(bool groupByInheritance READ groupByInheritance WRITE setGroupByInheritance DESIGNABLE true USER true)
71 Q_PROPERTY(QString nameFilterPattern READ nameFilterPattern WRITE setNameFilterPattern DESIGNABLE true USER true)
72
73 public:
77 typedef Property* (*UserTypeCB)(
78 const QString& name, QObject* propertyObject, Property* parent);
79
86 QPropertyEditorWidget(QWidget* parent = 0);
87
89 virtual ~QPropertyEditorWidget();
90
98 void addObject(QObject* propertyObject);
99
108 void setObject(QObject* propertyObject);
109
116 void updateObject(QObject* propertyObject);
117
124 void registerCustomPropertyCB(UserTypeCB callback);
125
130 void unregisterCustomPropertyCB(UserTypeCB callback);
131
132 void setSorted(bool enabled);
133
134 bool sorted() const;
135
136 bool groupByInheritance() const;
137
138 QString nameFilterPattern() const;
139
140 protected:
141 void mousePressEvent(QMouseEvent* event);
142 void keyPressEvent(QKeyEvent* event);
143
144 private:
148 QScopedPointer<QPropertyEditorWidgetPrivate> d_ptr;
149 Q_DECLARE_PRIVATE(QPropertyEditorWidget);
150
151 signals:
152
153 public slots:
154 void setGroupByInheritance(bool enabled);
155
156 void setNameFilterPattern(const QString &wildcardPattern);
157
158 private slots:
159 void sortedAction(bool checked);
160 void dataChanged();
161 };
162
163#ifdef __APPLE__
164}
165#endif
166
167#endif
Definition Property.h:41
The QPropertyEditorWidget offers an easy to use mechanism to visualize properties of a class inherite...
Definition QPropertyEditorWidget.h:67
QScopedPointer< QPropertyEditorWidgetPrivate > d_ptr
Definition QPropertyEditorWidget.h:148
Definition QPropertyEditorWidget.cpp:81
Definition QPropertyModel.h:39