![]() |
Workspace 7.1.0
|
The QtTreePropertyBrowser class provides QTreeWidget based property browser. More...
#include <Workspace/Widgets/PropertyBrowser/qttreepropertybrowser.h>
Public Types | |
enum | ResizeMode { Interactive , Stretch , Fixed , ResizeToContents } |
Signals | |
void | collapsed (QtBrowserItem *item) |
void | expanded (QtBrowserItem *item) |
![]() | |
void | currentItemChanged (QtBrowserItem *) |
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) |
![]() | |
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 | |
![]() | |
QtBrowserItem * | addProperty (QtProperty *property) |
QtBrowserItem * | insertProperty (QtProperty *property, QtProperty *afterProperty) |
void | removeProperty (QtProperty *property) |
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.
enum ResizeMode |
The resize mode specifies the behavior of the header sections.
Enumerator | |
---|---|
Interactive | |
Stretch | |
Fixed | |
ResizeToContents |
QtTreePropertyBrowser | ( | QWidget * | parent = nullptr | ) |
Creates a property browser with the given parent.
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.
bool alternatingRowColors | ( | ) | const |
QColor backgroundColor | ( | QtBrowserItem * | item | ) | const |
Returns the item's color. If there is no color set for item it returns invalid color.
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.
|
signal |
This signal is emitted when the item is collapsed.
void editItem | ( | QtBrowserItem * | item | ) |
Sets the current item to item and opens the relevant editor for it.
|
signal |
This signal is emitted when the item is expanded.
int indentation | ( | ) | const |
bool isExpanded | ( | QtBrowserItem * | item | ) | const |
Returns true if the item is expanded; otherwise returns false.
bool isHeaderVisible | ( | ) | const |
bool isItemVisible | ( | QtBrowserItem * | item | ) | const |
bool isSelected | ( | QtBrowserItem * | item | ) | const |
Returns true if the item is selected; otherwise returns false.
|
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).
Implements QtAbstractPropertyBrowser.
|
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.
Implements QtAbstractPropertyBrowser.
|
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.
Implements QtAbstractPropertyBrowser.
bool propertiesWithoutValueMarked | ( | ) | const |
QtTreePropertyBrowser::ResizeMode resizeMode | ( | ) | const |
bool rootIsDecorated | ( | ) | const |
void setAlternatingRowColors | ( | bool | enable | ) |
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)
void setExpanded | ( | QtBrowserItem * | item, |
bool | expanded | ||
) |
Sets the item to either collapse or expanded, depending on the value of expanded.
void setHeaderVisible | ( | bool | visible | ) |
void setIndentation | ( | int | i | ) |
void setItemVisible | ( | QtBrowserItem * | item, |
bool | visible | ||
) |
void setPropertiesWithoutValueMarked | ( | bool | mark | ) |
void setResizeMode | ( | QtTreePropertyBrowser::ResizeMode | mode | ) |
void setRootIsDecorated | ( | bool | show | ) |
void setSelected | ( | QtBrowserItem * | item, |
bool | selected | ||
) |
Sets the item to either selected or unselected, depending on the value of selected.
void setSplitterPosition | ( | int | position | ) |
void setTreeProperties | ( | const QString & | json | ) |
int splitterPosition | ( | ) | const |
QString treeProperties | ( | ) | const |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
When marking is enabled the item's background is rendered in dark color and item's foreground is rendered with light color.
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |