Logo Search packages:      
Sourcecode: qsapecng version File versions  Download package

Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

QtAbstractPropertyBrowser Class Reference

QtAbstractPropertyBrowser provides a base class for implementing property browsers. More...

Inheritance diagram for QtAbstractPropertyBrowser:
Inheritance graph
[legend]
Collaboration diagram for QtAbstractPropertyBrowser:
Collaboration graph
[legend]

List of all members.

Public Slots

QtBrowserItemaddProperty (QtProperty *property)
QtBrowserIteminsertProperty (QtProperty *property, QtProperty *afterProperty)
void removeProperty (QtProperty *property)

Signals

void currentItemChanged (QtBrowserItem *)

Public Member Functions

void clear ()
QtBrowserItemcurrentItem () const
QList< QtBrowserItem * > items (QtProperty *property) const
QList< QtProperty * > properties () const
 QtAbstractPropertyBrowser (QWidget *parent=0)
void setCurrentItem (QtBrowserItem *)
template<class PropertyManager >
void setFactoryForManager (PropertyManager *manager, QtAbstractEditorFactory< PropertyManager > *factory)
QtBrowserItemtopLevelItem (QtProperty *property) const
QList< QtBrowserItem * > topLevelItems () const
void unsetFactoryForManager (QtAbstractPropertyManager *manager)
 ~QtAbstractPropertyBrowser ()

Protected Member Functions

virtual QWidget * createEditor (QtProperty *property, QWidget *parent)
virtual void itemChanged (QtBrowserItem *item)=0
virtual void itemInserted (QtBrowserItem *item, QtBrowserItem *afterItem)=0
virtual void itemRemoved (QtBrowserItem *item)=0

Private Member Functions

bool addFactory (QtAbstractPropertyManager *abstractManager, QtAbstractEditorFactoryBase *abstractFactory)
 Q_PRIVATE_SLOT (d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *)) Q_PRIVATE_SLOT(d_func()
void void slotPropertyDestroyed (QtProperty *)) Q_PRIVATE_SLOT(d_func()
void slotPropertyRemoved (QtProperty *, QtProperty *)) Q_PRIVATE_SLOT(d_func()

Private Attributes

QtAbstractPropertyBrowserPrivated_ptr

Detailed Description

QtAbstractPropertyBrowser provides a base class for implementing property browsers.

A property browser is a widget that enables the user to edit a given set of properties. Each property is represented by a label specifying the property's name, and an editing widget (e.g. a line edit or a combobox) holding its value. A property can have zero or more subproperties.

The top level properties can be retrieved using the properties() function. To traverse each property's subproperties, use the QtProperty::subProperties() function. In addition, the set of top level properties can be manipulated using the addProperty(), insertProperty() and removeProperty() functions. Note that the QtProperty class provides a corresponding set of functions making it possible to manipulate the set of subproperties as well.

To remove all the properties from the property browser widget, use the clear() function. This function will clear the editor, but it will not delete the properties since they can still be used in other editors.

The properties themselves are created and managed by implementations of the QtAbstractPropertyManager class. A manager can handle (i.e. create and manage) properties of a given type. In the property browser the managers are associated with implementations of the QtAbstractEditorFactory: A factory is a class able to create an editing widget of a specified type.

When using a property browser widget, managers must be created for each of the required property types before the properties themselves can be created. To ensure that the properties' values will be displayed using suitable editing widgets, the managers must be associated with objects of the preferred factory implementations using the setFactoryForManager() function. The property browser will use these associations to determine which factory it should use to create the preferred editing widget.

Note that a factory can be associated with many managers, but a manager can only be associated with one single factory within the context of a single property browser. The associations between managers and factories can at any time be removed using the unsetFactoryForManager() function.

Whenever the property data changes or a property is inserted or removed, the itemChanged(), itemInserted() or itemRemoved() functions are called, respectively. These functions must be reimplemented in derived classes in order to update the property browser widget. Be aware that some property instances can appear several times in an abstract tree structure. For example:

100%

        QtProperty *property1, *property2, *property3;

        property2->addSubProperty(property1);
        property3->addSubProperty(property2);

        QtAbstractPropertyBrowser *editor;

        editor->addProperty(property1);
        editor->addProperty(property2);
        editor->addProperty(property3);

The addProperty() function returns a QtBrowserItem that uniquely identifies the created item.

To make a property editable in the property browser, the createEditor() function must be called to provide the property with a suitable editing widget.

Note that there are two ready-made property browser implementations:

QtGroupBoxPropertyBrowser QtTreePropertyBrowser

See also:
QtAbstractPropertyManager, QtAbstractEditorFactoryBase

Definition at line 309 of file qtpropertybrowser.h.


The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index