CVB++ 14.1
PropertyGrid Class Reference

View to display a device's nodemap. More...

#include <cvb/ui/property_grid.hpp>

Inherits QTreeView.

Public Member Functions

 PropertyGrid (const NodeMapPtr &nodemap, QWidget *parent=nullptr)
 Create a property grid. More...
 
void SetNodeMap (const NodeMapPtr &nodemap)
 Set the nodemap and exchanges the model. More...
 
NodeMapPtr NodeMap ()
 Return the nodemap. More...
 
void ReleaseNodeMap ()
 Release the nodemap. More...
 
void SetVisibility (GenApi::Visibility visibility)
 Set the visibility of the nodemap. More...
 
GenApi::Visibility Visibility ()
 Returns the visibility of the nodemap. More...
 
QString HtmlFormattedDescription (const QModelIndex &index)
 Returns an HTML formatted description of given node by QModelIndex. More...
 
QModelIndexList Search (const QString &text)
 Search for displayed property name. More...
 
void ResetSearch ()
 Reset the search text. More...
 
QString SearchText ()
 Returns the search text which is currently set. More...
 
void SetSearchResultBackgroundColor (QColor color)
 Set the search result background color. More...
 
QColor SearchResultBackgroundColor ()
 Returns the search result background color. More...
 
NodePtr Node (const QModelIndex &index)
 The node of the given QModelIndex. More...
 
void ExpandSearchResult (const QModelIndexList &indexList)
 Expands all nodes of given QModelIndexList as well as its parents. More...
 
void CollapseSearchResult (const QModelIndexList &indexList)
 Collapses all nodes of given QModelIndexList as well as its parents. More...
 
void UpdateProperty (const QModelIndex &index)
 Updates a given property / node. More...
 
void Update ()
 Updates all properties / nodes. More...
 
void StartAutoUpdate (int ms)
 Starts the automatic update of the nodes. More...
 
void StopAutoUpdate ()
 Stops the automatic update of the nodes. More...
 
void ResetUpdateLock ()
 Reset the update lock. More...
 

Detailed Description

View to display a device's nodemap.

This is the main class to display a nodemap as a QTreeView widget. It supports all the features provided by QTreeView.

auto grid = new Cvb::UI::PropertyGrid(dev->NodeMap(CVB_LIT("Device")));
grid->SetVisibility(Cvb::Visibility::Beginner);
auto layout = new QVBoxLayout;
View to display a device's nodemap.
Definition: property_grid.hpp:157
void addWidget(QWidget *w)
QLayout * layout() const const
Examples
Cvb/QtPropertyGrid.

Constructor & Destructor Documentation

◆ PropertyGrid()

PropertyGrid ( const NodeMapPtr &  nodemap,
QWidget parent = nullptr 
)
inlineexplicit

Create a property grid.

Parameters
[in]nodemapThe nodemap to display in QTreeView.
[in]parentParent object in Qt's object hierarchy.
Exceptions
Anyexception derived from std::exception.

Member Function Documentation

◆ CollapseSearchResult()

void CollapseSearchResult ( const QModelIndexList &  indexList)
inline

Collapses all nodes of given QModelIndexList as well as its parents.

Parameters
[in]indexListAn index list to collapse.
Exceptions
Doesnot throw any exception.

◆ ExpandSearchResult()

void ExpandSearchResult ( const QModelIndexList &  indexList)
inline

Expands all nodes of given QModelIndexList as well as its parents.

Parameters
[in]indexListAn index list to expand.
Exceptions
Doesnot throw any exception.

◆ HtmlFormattedDescription()

QString HtmlFormattedDescription ( const QModelIndex index)
inline

Returns an HTML formatted description of given node by QModelIndex.

Parameters
[in]indexThe index selected in QTreeView.
Returns
The HTML formatted description.
Exceptions
Doesnot throw any exception.

◆ Node()

NodePtr Node ( const QModelIndex index)
inline

The node of the given QModelIndex.

Parameters
[in]indexThe index to get the node from.
Returns
The node pointer.
Exceptions
Doesnot throw any exception.

◆ NodeMap()

NodeMapPtr NodeMap ( )
inline

Return the nodemap.

Returns
The nodemap.
Exceptions
Doesnot throw any exception.

◆ ReleaseNodeMap()

void ReleaseNodeMap ( )
inline

Release the nodemap.

Exceptions
Doesnot throw any exception.

◆ ResetSearch()

void ResetSearch ( )
inline

Reset the search text.

Exceptions
Doesnot throw any exception.

◆ ResetUpdateLock()

void ResetUpdateLock ( )
inline

Reset the update lock.

Exceptions
Doesnot throw any exception.

If a timeout occurs while retrieving a node value, the update function will be locked to avoid blocking the UI, e.g. if the device is disconnected. If the device is connected again, the update lock has to be reset.

◆ Search()

QModelIndexList Search ( const QString text)
inline

Search for displayed property name.

Parameters
[in]textThe text to find.
Returns
A list with all found QModelIndex which will be highlighted in the QTreeView with SearchResultBackgroundColor.
Exceptions
Doesnot throw any exception.

◆ SearchResultBackgroundColor()

QColor SearchResultBackgroundColor ( )
inline

Returns the search result background color.

Returns
The search result background color.
Exceptions
Doesnot throw any exception.

◆ SearchText()

QString SearchText ( )
inline

Returns the search text which is currently set.

Returns
The current search text.
Exceptions
Doesnot throw any exception.

◆ SetNodeMap()

void SetNodeMap ( const NodeMapPtr &  nodemap)
inline

Set the nodemap and exchanges the model.

Parameters
[in]nodemapThe nodemap.
Exceptions
Anyexception derived from std::exception.

◆ SetSearchResultBackgroundColor()

void SetSearchResultBackgroundColor ( QColor  color)
inline

Set the search result background color.

Parameters
[in]colorThe color to highlight the search result.
Exceptions
Doesnot throw any exception.

◆ SetVisibility()

void SetVisibility ( GenApi::Visibility  visibility)
inline

Set the visibility of the nodemap.

Parameters
[in]visibilityThe maximum visibility of the nodemap.
Exceptions
Anyexception derived from std::exception.

◆ StartAutoUpdate()

void StartAutoUpdate ( int  ms)
inline

Starts the automatic update of the nodes.

Parameters
[in]msThe time in milliseconds to update (e.g. for an update per second set 1000 ms).
Exceptions
Doesnot throw any exception.

◆ StopAutoUpdate()

void StopAutoUpdate ( )
inline

Stops the automatic update of the nodes.

Exceptions
Doesnot throw any exception.

◆ Update()

void Update ( )
inline

Updates all properties / nodes.

Exceptions
Doesnot throw any exception.

◆ UpdateProperty()

void UpdateProperty ( const QModelIndex index)
inline

Updates a given property / node.

Parameters
[in]indexThe property to update.
Exceptions
Doesnot throw any exception.

◆ Visibility()

GenApi::Visibility Visibility ( )
inline

Returns the visibility of the nodemap.

Returns
The maximum visibility of the nodemap.
Exceptions
Doesnot throw any exception.