|  | Home

# QtTreePropertyBrowser Class Reference

The QtTreePropertyBrowser class provides QTreeWidget based property browser. More...

     #include <QtTreePropertyBrowser>

Inherits QtAbstractPropertyBrowser.

- List of all members, including inherited members

### Public Types

- enum ResizeMode { Interactive, Fixed, Stretch, ResizeToContents }

### Properties

- alternatingRowColors : bool
- headerVisible : bool
- indentation : int
- propertiesWithoutValueMarked : bool

- resizeMode : ResizeMode
- rootIsDecorated : bool
- splitterPosition : int

- 57 properties inherited from QWidget
- 1 property inherited from QObject

### Public Functions

- QtTreePropertyBrowser ( QWidget * parent = 0 )
- ~QtTreePropertyBrowser ()
- bool alternatingRowColors () const
- QColor backgroundColor ( QtBrowserItem * item ) const
- QColor calculatedBackgroundColor ( QtBrowserItem * item ) const
- void editItem ( QtBrowserItem * item )
- int indentation () const
- bool isExpanded ( QtBrowserItem * item ) const
- bool isHeaderVisible () const
- bool isItemVisible ( QtBrowserItem * item ) const
- bool propertiesWithoutValueMarked () const
- ResizeMode resizeMode () const
- bool rootIsDecorated () const
- void setAlternatingRowColors ( bool enable )
- void setBackgroundColor ( QtBrowserItem * item, const QColor & color )
- void setExpanded ( QtBrowserItem * item, bool expanded )
- void setHeaderVisible ( bool visible )
- void setIndentation ( int i )
- void setItemVisible ( QtBrowserItem * item, bool visible )
- void setPropertiesWithoutValueMarked ( bool mark )
- void setResizeMode ( ResizeMode mode )
- void setRootIsDecorated ( bool show )
- void setSplitterPosition ( int position )
- int splitterPosition () const

- 9 public functions inherited from QtAbstractPropertyBrowser
- 206 public functions inherited from QWidget
- 29 public functions inherited from QObject
- 12 public functions inherited from QPaintDevice

### Signals

- void collapsed ( QtBrowserItem * item )
- void expanded ( QtBrowserItem * item )

- 1 signal inherited from QtAbstractPropertyBrowser
- 1 signal inherited from QWidget
- 1 signal inherited from QObject

### Additional Inherited Members

- 3 public slots inherited from QtAbstractPropertyBrowser
- 19 public slots inherited from QWidget
- 1 public slot inherited from QObject
- 1 public type inherited from QObject
- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject
- 4 protected functions inherited from QtAbstractPropertyBrowser
- 38 protected functions inherited from QWidget
- 7 protected functions inherited from QObject
- 1 protected function inherited from QPaintDevice
- 1 protected slot inherited from QWidget
- 2 protected variables inherited from QObject
- 1 protected type inherited from QPaintDevice

## Detailed Description

The QtTreePropertyBrowser class provides QTreeWidget based property browser.

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.

QtTreePropertyBrowser provides a tree based view for all nested properties, i.e. properties that have subproperties can be in an expanded (subproperties are visible) or collapsed (subproperties are hidden) state. For example:

Use the QtAbstractPropertyBrowser API to add, insert and remove properties from an instance of the QtTreePropertyBrowser class. The properties themselves are created and managed by implementations of the QtAbstractPropertyManager class.

See also QtGroupBoxPropertyBrowser and QtAbstractPropertyBrowser.

## Member Type Documentation

### enum QtTreePropertyBrowser::ResizeMode

The resize mode specifies the behavior of the header sections.

Constant | Value | Description
--- | --- | ---
`QtTreePropertyBrowser::Interactive` | `0` | The user can resize the sections. The sections can also be resized programmatically using setSplitterPosition().
`QtTreePropertyBrowser::Fixed` | `2` | The user cannot resize the section. The section can only be resized programmatically using setSplitterPosition().
`QtTreePropertyBrowser::Stretch` | `1` | QHeaderView will automatically resize the section to fill the available space. The size cannot be changed by the user or programmatically.
`QtTreePropertyBrowser::ResizeToContents` | `3` | QHeaderView will automatically resize the section to its optimal size based on the contents of the entire column. The size cannot be changed by the user or programmatically.

See also setResizeMode().

## Property Documentation

### alternatingRowColors : bool

This property holds whether to draw the background using alternating colors. By default this property is set to true.

Access functions:

- bool alternatingRowColors () const
- void setAlternatingRowColors ( bool enable )

### headerVisible : bool

This property holds whether to show the header.

Access functions:

- bool isHeaderVisible () const
- void setHeaderVisible ( bool visible )

### indentation : int

This property holds indentation of the items in the tree view.

Access functions:

- int indentation () const
- void setIndentation ( int i )

### propertiesWithoutValueMarked : bool

This property holds whether to enable or disable marking properties without value.

When marking is enabled the item's background is rendered in dark color and item's foreground is rendered with light color.

Access functions:

- bool propertiesWithoutValueMarked () const
- void setPropertiesWithoutValueMarked ( bool mark )

See also propertiesWithoutValueMarked().

### resizeMode : ResizeMode

This property holds the resize mode of setions in the header.

Access functions:

- ResizeMode resizeMode () const
- void setResizeMode ( ResizeMode mode )

### rootIsDecorated : bool

This property holds whether to show controls for expanding and collapsing root items.

Access functions:

- bool rootIsDecorated () const
- void setRootIsDecorated ( bool show )

### splitterPosition : int

This property holds the position of the splitter between the colunms.

Access functions:

- int splitterPosition () const
- void setSplitterPosition ( int position )

## Member Function Documentation

### QtTreePropertyBrowser::QtTreePropertyBrowser ( QWidget * parent = 0 )

Creates a property browser with the given parent.

### QtTreePropertyBrowser::~QtTreePropertyBrowser ()

Destroys this property browser.

Note that the properties that were inserted into this browser are not destroyed since they may still be used in other browsers. The properties are owned by the manager that created them.

See also QtProperty and QtAbstractPropertyManager.

### QColor QtTreePropertyBrowser::backgroundColor ( QtBrowserItem * item ) const

Returns the item's color. If there is no color set for item it returns invalid color.

See also calculatedBackgroundColor() and setBackgroundColor().

### QColor QtTreePropertyBrowser::calculatedBackgroundColor ( QtBrowserItem * item ) const

Returns the item's color. If there is no color set for item it returns parent item's color (if there is no color set for parent it returns grandparent's color and so on). In case the color is not set for item and it's top level item it returns invalid color.

See also backgroundColor() and setBackgroundColor().

### void QtTreePropertyBrowser::collapsed ( QtBrowserItem * item ) `[signal]`

This signal is emitted when the item is collapsed.

See also expanded() and setExpanded().

### void QtTreePropertyBrowser::editItem ( QtBrowserItem * item )

Sets the current item to item and opens the relevant editor for it.

### void QtTreePropertyBrowser::expanded ( QtBrowserItem * item ) `[signal]`

This signal is emitted when the item is expanded.

See also collapsed() and setExpanded().

### bool QtTreePropertyBrowser::isExpanded ( QtBrowserItem * item ) const

Returns true if the item is expanded; otherwise returns false.

See also setExpanded().

### bool QtTreePropertyBrowser::isItemVisible ( QtBrowserItem * item ) const

Returns true if the item is visible; otherwise returns false.

This function was introduced in qtpropertybrowser 4.5.

See also setItemVisible().

### void QtTreePropertyBrowser::setBackgroundColor ( QtBrowserItem * item, const QColor & color )

Sets the item's background color to color. Note that while item's background is rendered every second row is being drawn with alternate color (which is a bit lighter than items color)

See also backgroundColor() and calculatedBackgroundColor().

### void QtTreePropertyBrowser::setExpanded ( QtBrowserItem * item, bool expanded )

Sets the item to either collapse or expanded, depending on the value of expanded.

See also isExpanded(), expanded(), and collapsed().

### void QtTreePropertyBrowser::setItemVisible ( QtBrowserItem * item, bool visible )

Sets the item to be visible, depending on the value of visible.

This function was introduced in qtpropertybrowser 4.5.

See also isItemVisible().