40 #pragma GCC system_header
42 #ifndef QTPROPERTYBROWSER_H
43 #define QTPROPERTYBROWSER_H
45 #include <QtGui/QWidget>
46 #include <QtCore/QSet>
47 #include <QtGui/QLineEdit>
48 #include <QtCore/QMap>
50 #if QT_VERSION >= 0x040400
55 # if !defined(QT_QTPROPERTYBROWSER_EXPORT) && \
56 !defined(QT_QTPROPERTYBROWSER_IMPORT)
57 # define QT_QTPROPERTYBROWSER_EXPORT
58 # elif defined(QT_QTPROPERTYBROWSER_IMPORT)
59 # if defined(QT_QTPROPERTYBROWSER_EXPORT)
60 # undef QT_QTPROPERTYBROWSER_EXPORT
62 # define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllimport)
63 # elif defined(QT_QTPROPERTYBROWSER_EXPORT)
64 # undef QT_QTPROPERTYBROWSER_EXPORT
65 # define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllexport)
68 # define QT_QTPROPERTYBROWSER_EXPORT
82 QList<QtProperty *> subProperties()
const;
86 QString toolTip()
const;
87 QString statusTip()
const;
88 QString whatsThis()
const;
89 QString propertyName()
const;
90 bool isEnabled()
const;
91 bool isModified()
const;
93 bool hasValue()
const;
94 QIcon valueIcon()
const;
95 QString valueText()
const;
96 QString displayText()
const;
98 void setToolTip(
const QString &text);
99 void setStatusTip(
const QString &text);
100 void setWhatsThis(
const QString &text);
101 void setPropertyName(
const QString &text);
102 void setEnabled(
bool enable);
103 void setModified(
bool modified);
110 void propertyChanged();
149 QSet<QtProperty *> properties()
const;
152 QtProperty *addProperty(
const QString &name = QString());
161 virtual bool hasValue(
const QtProperty *property)
const;
162 virtual QIcon valueIcon(
const QtProperty *property)
const;
163 virtual QString valueText(
const QtProperty *property)
const;
164 virtual QString displayText(
const QtProperty *property)
const;
166 virtual void initializeProperty(
QtProperty *property) = 0;
167 virtual void uninitializeProperty(
QtProperty *property);
178 QtAbstractPropertyManager *q_ptr;
179 Q_DECLARE_PUBLIC(QtAbstractPropertyManager)
181 QtAbstractPropertyManagerPrivate() : q_ptr(
NULL) {}
189 QSet<QtProperty *> m_properties;
196 virtual QWidget *createEditor(
QtProperty *property, QWidget *parent) = 0;
203 virtual void managerDestroyed(QObject *manager) = 0;
208 template <
class PropertyManager>
217 QSetIterator<PropertyManager *> it(m_managers);
220 PropertyManager *manager = it.next();
223 return createEditor(manager, property, parent);
231 if (m_managers.contains(manager))
233 m_managers.insert(manager);
234 connectPropertyManager(manager);
235 connect(manager, SIGNAL(destroyed(QObject *)),
236 this, SLOT(managerDestroyed(QObject *)));
241 if (!m_managers.contains(manager))
243 disconnect(manager, SIGNAL(destroyed(QObject *)),
244 this, SLOT(managerDestroyed(QObject *)));
245 disconnectPropertyManager(manager);
246 m_managers.remove(manager);
257 QSetIterator<PropertyManager *> itManager(m_managers);
258 while (itManager.hasNext())
260 PropertyManager *m = itManager.next();
269 virtual void connectPropertyManager(PropertyManager *manager) = 0;
270 virtual QWidget *createEditor(PropertyManager *manager,
272 QWidget *parent) = 0;
273 virtual void disconnectPropertyManager(PropertyManager *manager) = 0;
277 QSetIterator<PropertyManager *> it(m_managers);
280 PropertyManager *m = it.next();
283 m_managers.remove(m);
292 QSetIterator<PropertyManager *> it(m_managers);
295 PropertyManager *m = it.next();
298 removePropertyManager(m);
304 QSet<PropertyManager *> m_managers;
305 friend class QtAbstractPropertyEditor;
316 QList<QtBrowserItem *> children()
const;
331 : m_browser(browser), m_property(property), m_parent(parent), q_ptr(0) {}
364 void slotPropertyInserted(
QtProperty *property,
367 void slotPropertyDestroyed(
QtProperty *property);
368 void slotPropertyDataChanged(
QtProperty *property);
370 QList<QtProperty *> m_subItems;
372 QList<QtProperty *> > m_managerToProperties;
373 QMap<QtProperty *, QList<QtProperty *> > m_propertyToParents;
375 QMap<QtProperty *, QtBrowserItem *> m_topLevelPropertyToIndex;
376 QList<QtBrowserItem *> m_topLevelIndexes;
377 QMap<QtProperty *, QList<QtBrowserItem *> > m_propertyToIndexes;
392 QList<QtProperty *> properties()
const;
393 QList<QtBrowserItem *> items(
QtProperty *property)
const;
395 QList<QtBrowserItem *> topLevelItems()
const;
398 template <
class PropertyManager>
406 if (addFactory(abstractManager, abstractFactory))
433 virtual QWidget *createEditor(
QtProperty *property, QWidget *parent);
442 Q_PRIVATE_SLOT(d_func(),
void slotPropertyInserted(
QtProperty *,
443 QtProperty *, QtProperty *))
444 Q_PRIVATE_SLOT(d_func(),
void slotPropertyRemoved(QtProperty *,
446 Q_PRIVATE_SLOT(d_func(),
void slotPropertyDestroyed(QtProperty *))
447 Q_PRIVATE_SLOT(d_func(),
void slotPropertyDataChanged(QtProperty *))
450 #if QT_VERSION >= 0x040400
454 #endif // QTPROPERTYBROWSER_H
QtAbstractEditorFactoryBase(QObject *parent=0)
Definition: qtpropertybrowser.h:198
Definition: qtpropertybrowser.h:116
QtAbstractPropertyBrowser *const m_browser
Definition: qtpropertybrowser.h:336
Definition: qtpropertybrowser.h:384
Definition: qtpropertybrowser.h:311
Definition: qtpropertybrowser.h:176
QList< QtProperty * > m_subItems
Definition: qtpropertybrowser.h:127
Definition: qtpropertybrowser.h:141
Definition: qtpropertybrowser.h:326
QtBrowserItem * q_ptr
Definition: qtpropertybrowser.h:340
void addPropertyManager(PropertyManager *manager)
Definition: qtpropertybrowser.h:228
QString m_statusTip
Definition: qtpropertybrowser.h:130
QtAbstractPropertyManager * propertyManager() const
QtBrowserItem * m_parent
Definition: qtpropertybrowser.h:338
Definition: qtpropertybrowser.h:209
QtAbstractEditorFactory(QObject *parent)
Definition: qtpropertybrowser.h:212
QSet< QtProperty * > m_parentItems
Definition: qtpropertybrowser.h:126
GAZEBO_VISIBLE void enable()
Enable sensors.
QWidget * createEditor(QtProperty *property, QWidget *parent)
Definition: qtpropertybrowser.h:214
bool m_modified
Definition: qtpropertybrowser.h:134
void setFactoryForManager(PropertyManager *manager, QtAbstractEditorFactory< PropertyManager > *factory)
Definition: qtpropertybrowser.h:399
QList< QtBrowserItem * > m_children
Definition: qtpropertybrowser.h:342
void managerDestroyed(QObject *manager)
Definition: qtpropertybrowser.h:274
QtBrowserItemPrivate(QtAbstractPropertyBrowser *browser, QtProperty *property, QtBrowserItem *parent)
Definition: qtpropertybrowser.h:329
#define NULL
Definition: CommonTypes.hh:30
#define QT_QTPROPERTYBROWSER_EXPORT
Definition: qtpropertybrowser.h:68
QtProperty * m_property
Definition: qtpropertybrowser.h:337
Definition: qtpropertybrowser.h:77
QString m_toolTip
Definition: qtpropertybrowser.h:129
void removePropertyManager(PropertyManager *manager)
Definition: qtpropertybrowser.h:238
QString m_whatsThis
Definition: qtpropertybrowser.h:131
QString m_name
Definition: qtpropertybrowser.h:132
PropertyManager * propertyManager(QtProperty *property) const
Definition: qtpropertybrowser.h:253
QLineEdit::EchoMode EchoMode
Definition: qtpropertybrowser.h:71
QtProperty * q_ptr
Definition: qtpropertybrowser.h:124
Definition: qtpropertybrowser.h:345
Definition: qtpropertybrowser.h:192
QSet< PropertyManager * > propertyManagers() const
Definition: qtpropertybrowser.h:248
QtPropertyPrivate(QtAbstractPropertyManager *manager)
Definition: qtpropertybrowser.h:119
bool m_enabled
Definition: qtpropertybrowser.h:133
QtAbstractPropertyManager *const m_manager
Definition: qtpropertybrowser.h:136