Workspace 6.21.5
Public Types | Signals | Public Member Functions | Static Public Attributes | Protected Member Functions | Properties | List of all members
QtTreePropertyBrowser Class Reference

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

#include <Workspace/Widgets/PropertyBrowser/qttreepropertybrowser.h>

Inheritance diagram for QtTreePropertyBrowser:
[legend]

Public Types

enum  ResizeMode { Interactive , Stretch , Fixed , ResizeToContents }
 

Signals

void collapsed (QtBrowserItem *item)
 
void expanded (QtBrowserItem *item)
 
- Signals inherited from QtAbstractPropertyBrowser
void currentItemChanged (QtBrowserItem *)
 

Public Member Functions

 QtTreePropertyBrowser (QWidget *parent=nullptr)
 
 ~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 isSelected (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 setSelected (QtBrowserItem *item, bool selected)
 
void setSplitterPosition (int position)
 
void setTreeProperties (const QString &json)
 
int splitterPosition () const
 
QString treeProperties () const
 
- Public Member Functions inherited from QtAbstractPropertyBrowser
 QtAbstractPropertyBrowser (QWidget *parent=nullptr)
 
 ~QtAbstractPropertyBrowser ()
 
void clear ()
 
QtBrowserItemcurrentItem () const
 
QtAbstractPropertyManagergetPropertyManager () const
 
QList< QtBrowserItem * > items (QtProperty *property) const
 
QList< QtProperty * > properties () const
 
void setCurrentItem (QtBrowserItem *)
 
template<class PropertyManager >
void setFactoryForManager (PropertyManager *manager, QtAbstractEditorFactory< PropertyManager > *factory)
 
void setPropertyManager (QtAbstractPropertyManager &manager)
 
QtBrowserItemtopLevelItem (QtProperty *property) const
 
QList< QtBrowserItem * > topLevelItems () const
 
void unsetFactoryForManager (QtAbstractPropertyManager *manager)
 

Static Public Attributes

static constexpr const char * CHILDREN = "children"
 
static constexpr const char * DEFAULT_WIDGET_NAME = "<default>"
 
static constexpr const char * GLOBAL_NAME = "globalName"
 
static constexpr const char * LABEL = "label"
 
static constexpr const char * TOOLTIP = "toolTip"
 
static constexpr const char * WIDGET_NAME = "widgetName"
 
static constexpr const char * WIDGET_PROPERTIES = "widgetProperties"
 

Protected Member Functions

virtual void itemChanged (QtBrowserItem *item)
 
virtual void itemInserted (QtBrowserItem *item, QtBrowserItem *afterItem)
 
virtual void itemRemoved (QtBrowserItem *item)
 
- Protected Member Functions inherited from QtAbstractPropertyBrowser
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
 

Properties

bool alternatingRowColors
 whether to draw the background using alternating colors. By default this property is set to true.
 
bool headerVisible
 whether to show the header.
 
int indentation
 indentation of the items in the tree view.
 
bool propertiesWithoutValueMarked
 whether to enable or disable marking properties without value.
 
ResizeMode resizeMode
 the resize mode of setions in the header.
 
bool rootIsDecorated
 whether to show controls for expanding and collapsing root items.
 
int splitterPosition
 the position of the splitter between the colunms.
 
QString treeProperties
 

Additional Inherited Members

- Public Slots inherited from QtAbstractPropertyBrowser
QtBrowserItemaddProperty (QtProperty *property)
 
QtBrowserIteminsertProperty (QtProperty *property, QtProperty *afterProperty)
 
void removeProperty (QtProperty *property)
 

Detailed Description

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, QtAbstractPropertyBrowser

Member Enumeration Documentation

◆ ResizeMode

enum ResizeMode

The resize mode specifies the behavior of the header sections.

  • Interactive The user can resize the sections. The sections can also be resized programmatically using setSplitterPosition().
  • Fixed The user cannot resize the section. The section can only be resized programmatically using setSplitterPosition().
  • Stretch QHeaderView will automatically resize the section to fill the available space. The size cannot be changed by the user or programmatically.
  • ResizeToContents 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()
Enumerator
Interactive 
Stretch 
Fixed 
ResizeToContents 

Constructor & Destructor Documentation

◆ QtTreePropertyBrowser()

QtTreePropertyBrowser ( QWidget *  parent = nullptr)

Creates a property browser with the given parent.

◆ ~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, QtAbstractPropertyManager

Member Function Documentation

◆ alternatingRowColors()

bool alternatingRowColors ( ) const

◆ backgroundColor()

QColor backgroundColor ( QtBrowserItem item) const

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

See also
calculatedBackgroundColor(), setBackgroundColor()

◆ calculatedBackgroundColor()

QColor 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(), setBackgroundColor()

◆ collapsed

void collapsed ( QtBrowserItem item)
signal

This signal is emitted when the item is collapsed.

See also
expanded(), setExpanded()

◆ editItem()

void editItem ( QtBrowserItem item)

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

◆ expanded

void expanded ( QtBrowserItem item)
signal

This signal is emitted when the item is expanded.

See also
collapsed(), setExpanded()

◆ indentation()

int indentation ( ) const

◆ isExpanded()

bool isExpanded ( QtBrowserItem item) const

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

See also
setExpanded()

◆ isHeaderVisible()

bool isHeaderVisible ( ) const

◆ isItemVisible()

bool isItemVisible ( QtBrowserItem item) const

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

See also
setItemVisible()
Since
4.5

◆ isSelected()

bool isSelected ( QtBrowserItem item) const

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

See also
setSelected()

◆ itemChanged()

void itemChanged ( QtBrowserItem item)
protectedvirtual

This function is called whenever a property's data changes, passing a pointer to the item of property as parameter.

This function must be reimplemented in derived classes in order to update the property browser widget whenever a property's name, tool tip, status tip, "what's this" text, value text or value icon changes.

Note that if the property browser contains several occurrences of the same property, this method will be called once for each occurrence (with a different item each time).

See also
QtProperty, items()

Implements QtAbstractPropertyBrowser.

◆ itemInserted()

void itemInserted ( QtBrowserItem insertedItem,
QtBrowserItem precedingItem 
)
protectedvirtual

This function is called to update the widget whenever a property is inserted or added to the property browser, passing pointers to the insertedItem of property and the specified precedingItem as parameters.

If precedingItem is 0, the insertedItem was put at the beginning of its parent item's list of subproperties. If the parent of insertedItem is 0, the insertedItem was added as a top level property of this property browser.

This function must be reimplemented in derived classes. Note that if the insertedItem's property has subproperties, this method will be called for those properties as soon as the current call is finished.

See also
insertProperty(), addProperty()

Implements QtAbstractPropertyBrowser.

◆ itemRemoved()

void itemRemoved ( QtBrowserItem item)
protectedvirtual

This function is called to update the widget whenever a property is removed from the property browser, passing the pointer to the item of the property as parameters. The passed item is deleted just after this call is finished.

If the the parent of item is 0, the removed item was a top level property in this editor.

This function must be reimplemented in derived classes. Note that if the removed item's property has subproperties, this method will be called for those properties just before the current call is started.

See also
removeProperty()

Implements QtAbstractPropertyBrowser.

◆ propertiesWithoutValueMarked()

bool propertiesWithoutValueMarked ( ) const

◆ resizeMode()

QtTreePropertyBrowser::ResizeMode resizeMode ( ) const

◆ rootIsDecorated()

bool rootIsDecorated ( ) const

◆ setAlternatingRowColors()

void setAlternatingRowColors ( bool  enable)

◆ setBackgroundColor()

void 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(), calculatedBackgroundColor()

◆ setExpanded()

void setExpanded ( QtBrowserItem item,
bool  expanded 
)

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

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

◆ setHeaderVisible()

void setHeaderVisible ( bool  visible)

◆ setIndentation()

void setIndentation ( int  i)

◆ setItemVisible()

void setItemVisible ( QtBrowserItem item,
bool  visible 
)

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

See also
isItemVisible()
Since
4.5

◆ setPropertiesWithoutValueMarked()

void setPropertiesWithoutValueMarked ( bool  mark)

◆ setResizeMode()

void setResizeMode ( QtTreePropertyBrowser::ResizeMode  mode)

◆ setRootIsDecorated()

void setRootIsDecorated ( bool  show)

◆ setSelected()

void setSelected ( QtBrowserItem item,
bool  selected 
)

Sets the item to either selected or unselected, depending on the value of selected.

See also
isExpanded()

◆ setSplitterPosition()

void setSplitterPosition ( int  position)

◆ setTreeProperties()

void setTreeProperties ( const QString &  json)

◆ splitterPosition()

int splitterPosition ( ) const

◆ treeProperties()

QString treeProperties ( ) const

Member Data Documentation

◆ CHILDREN

constexpr const char* CHILDREN = "children"
staticconstexpr

◆ DEFAULT_WIDGET_NAME

constexpr const char* DEFAULT_WIDGET_NAME = "<default>"
staticconstexpr

◆ GLOBAL_NAME

constexpr const char* GLOBAL_NAME = "globalName"
staticconstexpr

◆ LABEL

constexpr const char* LABEL = "label"
staticconstexpr

◆ TOOLTIP

constexpr const char* TOOLTIP = "toolTip"
staticconstexpr

◆ WIDGET_NAME

constexpr const char* WIDGET_NAME = "widgetName"
staticconstexpr

◆ WIDGET_PROPERTIES

constexpr const char* WIDGET_PROPERTIES = "widgetProperties"
staticconstexpr

Property Documentation

◆ alternatingRowColors

alternatingRowColors
readwrite

◆ headerVisible

headerVisible
readwrite

◆ indentation

indentation
readwrite

◆ propertiesWithoutValueMarked

propertiesWithoutValueMarked
readwrite

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

See also
propertiesWithoutValueMarked()

◆ resizeMode

resizeMode
readwrite

◆ rootIsDecorated

rootIsDecorated
readwrite

◆ splitterPosition

splitterPosition
readwrite

◆ treeProperties

QString treeProperties
readwrite