41 #ifndef QTPROPERTYBROWSER_H 42 #define QTPROPERTYBROWSER_H 44 #include <QtGui/QWidget> 45 #include <QtCore/QSet> 46 #include <QtGui/QLineEdit> 47 #include <QtCore/QMap> 49 #if QT_VERSION >= 0x040400 54 # if !defined(QT_QTPROPERTYBROWSER_EXPORT) && !defined(QT_QTPROPERTYBROWSER_IMPORT) 55 # define QT_QTPROPERTYBROWSER_EXPORT 56 # elif defined(QT_QTPROPERTYBROWSER_IMPORT) 57 # if defined(QT_QTPROPERTYBROWSER_EXPORT) 58 # undef QT_QTPROPERTYBROWSER_EXPORT 60 # define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllimport) 61 # elif defined(QT_QTPROPERTYBROWSER_EXPORT) 62 # undef QT_QTPROPERTYBROWSER_EXPORT 63 # define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllexport) 66 # define QT_QTPROPERTYBROWSER_EXPORT 79 QList<QtProperty *> subProperties()
const;
83 QString toolTip()
const;
84 QString statusTip()
const;
85 QString whatsThis()
const;
86 QString propertyName()
const;
87 bool isEnabled()
const;
88 bool isModified()
const;
90 bool hasValue()
const;
91 QIcon valueIcon()
const;
92 QString valueText()
const;
93 QString displayText()
const;
95 void setToolTip(
const QString &text);
96 void setStatusTip(
const QString &text);
97 void setWhatsThis(
const QString &text);
98 void setPropertyName(
const QString &text);
99 void setEnabled(
bool enable);
100 void setModified(
bool modified);
107 void propertyChanged();
119 m_manager(manager) {};
142 void propertyChanged(
QtProperty *property)
const;
161 QSet<QtProperty *> properties()
const;
164 QtProperty *addProperty(
const QString &name = QString());
173 virtual bool hasValue(
const QtProperty *property)
const;
174 virtual QIcon valueIcon(
const QtProperty *property)
const;
175 virtual QString valueText(
const QtProperty *property)
const;
176 virtual QString displayText(
const QtProperty *property)
const;
178 virtual void initializeProperty(
QtProperty *property) = 0;
179 virtual void uninitializeProperty(
QtProperty *property);
192 virtual QWidget *createEditor(
QtProperty *property, QWidget *parent) = 0;
199 virtual void managerDestroyed(QObject *manager) = 0;
204 template <
class PropertyManager>
211 QSetIterator<PropertyManager *> it(m_managers);
212 while (it.hasNext()) {
213 PropertyManager *manager = it.next();
215 return createEditor(manager, property, parent);
222 if (m_managers.contains(manager))
224 m_managers.insert(manager);
225 connectPropertyManager(manager);
226 connect(manager, SIGNAL(destroyed(QObject *)),
227 this, SLOT(managerDestroyed(QObject *)));
231 if (!m_managers.contains(manager))
233 disconnect(manager, SIGNAL(destroyed(QObject *)),
234 this, SLOT(managerDestroyed(QObject *)));
235 disconnectPropertyManager(manager);
236 m_managers.remove(manager);
245 QSetIterator<PropertyManager *> itManager(m_managers);
246 while (itManager.hasNext()) {
247 PropertyManager *m = itManager.next();
255 virtual void connectPropertyManager(PropertyManager *manager) = 0;
256 virtual QWidget *createEditor(PropertyManager *manager,
QtProperty *property,
257 QWidget *parent) = 0;
258 virtual void disconnectPropertyManager(PropertyManager *manager) = 0;
261 QSetIterator<PropertyManager *> it(m_managers);
262 while (it.hasNext()) {
263 PropertyManager *m = it.next();
265 m_managers.remove(m);
273 QSetIterator<PropertyManager *> it(m_managers);
274 while (it.hasNext()) {
275 PropertyManager *m = it.next();
277 removePropertyManager(m);
283 QSet<PropertyManager *> m_managers;
284 friend class QtAbstractPropertyEditor;
294 : m_browser(browser), m_property(property), m_parent(parent), q_ptr(0) {};
314 QList<QtBrowserItem *> children()
const;
340 void slotPropertyInserted(
QtProperty *property,
343 void slotPropertyDestroyed(
QtProperty *property);
344 void slotPropertyDataChanged(
QtProperty *property);
365 QList<QtProperty *> properties()
const;
366 QList<QtBrowserItem *> items(
QtProperty *property)
const;
368 QList<QtBrowserItem *> topLevelItems()
const;
371 template <
class PropertyManager>
377 if (addFactory(abstractManager, abstractFactory))
402 virtual QWidget *createEditor(
QtProperty *property, QWidget *parent);
411 Q_PRIVATE_SLOT(d_func(),
void slotPropertyInserted(
QtProperty *,
413 Q_PRIVATE_SLOT(d_func(),
void slotPropertyRemoved(
QtProperty *,
415 Q_PRIVATE_SLOT(d_func(),
void slotPropertyDestroyed(
QtProperty *))
416 Q_PRIVATE_SLOT(d_func(),
void slotPropertyDataChanged(
QtProperty *))
420 #if QT_VERSION >= 0x040400 424 #endif // QTPROPERTYBROWSER_H QtAbstractEditorFactoryBase(QObject *parent=0)
Definition: qtpropertybrowser.h:194
QList< QtProperty * > m_subItems
Definition: qtpropertybrowser.h:346
Definition: qtpropertybrowser.h:113
QtAbstractPropertyBrowser *const m_browser
Definition: qtpropertybrowser.h:299
QtAbstractPropertyBrowser provides a base class for implementing property browsers.
Definition: qtpropertybrowser.h:357
The QtBrowserItem class represents a property in a property browser instance.
Definition: qtpropertybrowser.h:309
Definition: qtpropertybrowser.h:136
QList< QtProperty * > m_subItems
Definition: qtpropertybrowser.h:123
The QtAbstractPropertyManager provides an interface for property managers.
Definition: qtpropertybrowser.h:153
Definition: qtpropertybrowser.h:290
QtBrowserItem * q_ptr
Definition: qtpropertybrowser.h:303
void addPropertyManager(PropertyManager *manager)
Definition: qtpropertybrowser.h:220
QString m_statusTip
Definition: qtpropertybrowser.h:126
QtAbstractPropertyManager * propertyManager() const
Definition: qtpropertybrowser.cpp:170
QtBrowserItem * m_parent
Definition: qtpropertybrowser.h:301
The QtAbstractEditorFactory is the base template class for editor factories.
Definition: qtpropertybrowser.h:205
QtAbstractEditorFactory(QObject *parent)
Definition: qtpropertybrowser.h:208
QMap< QtProperty *, QtBrowserItem * > m_topLevelPropertyToIndex
Definition: qtpropertybrowser.h:350
QSet< QtProperty * > m_parentItems
Definition: qtpropertybrowser.h:122
QMap< QtProperty *, QList< QtProperty * > > m_propertyToParents
Definition: qtpropertybrowser.h:348
bool m_modified
Definition: qtpropertybrowser.h:130
void setFactoryForManager(PropertyManager *manager, QtAbstractEditorFactory< PropertyManager > *factory)
Definition: qtpropertybrowser.h:372
QList< QtBrowserItem * > m_children
Definition: qtpropertybrowser.h:305
void managerDestroyed(QObject *manager)
Definition: qtpropertybrowser.h:259
QtBrowserItemPrivate(QtAbstractPropertyBrowser *browser, QtProperty *property, QtBrowserItem *parent)
Definition: qtpropertybrowser.h:293
QMap< QtAbstractPropertyManager *, QList< QtProperty * > > m_managerToProperties
Definition: qtpropertybrowser.h:347
#define QT_QTPROPERTYBROWSER_EXPORT
Definition: qtpropertybrowser.h:66
QSet< PropertyManager * > propertyManagers() const
Definition: qtpropertybrowser.h:238
QtProperty * m_property
Definition: qtpropertybrowser.h:300
PropertyManager * propertyManager(QtProperty *property) const
Definition: qtpropertybrowser.h:242
QWidget * createEditor(QtProperty *property, QWidget *parent)
Definition: qtpropertybrowser.h:209
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:74
QString m_toolTip
Definition: qtpropertybrowser.h:125
void removePropertyManager(PropertyManager *manager)
Definition: qtpropertybrowser.h:229
QtBrowserItem * m_currentItem
Definition: qtpropertybrowser.h:354
QString m_whatsThis
Definition: qtpropertybrowser.h:127
QSet< QtProperty * > m_properties
Definition: qtpropertybrowser.h:148
QString m_name
Definition: qtpropertybrowser.h:128
QLineEdit::EchoMode EchoMode
Definition: qtpropertybrowser.h:69
QtProperty * q_ptr
Definition: qtpropertybrowser.h:119
Definition: qtpropertybrowser.h:323
The QtAbstractEditorFactoryBase provides an interface for editor factories.
Definition: qtpropertybrowser.h:188
QMap< QtProperty *, QList< QtBrowserItem * > > m_propertyToIndexes
Definition: qtpropertybrowser.h:352
QtPropertyPrivate(QtAbstractPropertyManager *manager)
Definition: qtpropertybrowser.h:116
bool m_enabled
Definition: qtpropertybrowser.h:129
QtAbstractPropertyManager *const m_manager
Definition: qtpropertybrowser.h:132
QList< QtBrowserItem * > m_topLevelIndexes
Definition: qtpropertybrowser.h:351