A class to efficiently build and maintain sorted items of QTreeWidget
or QTreeWidgetItem
based on a sorted container matching the intended structure.
More...
#include <RobotAPI/libraries/armem_gui/instance/tree_builders/DataTreeBuilderBase.h>
|
using | CompareFn = std::function< int(const ElementT &element, QTreeWidgetItem *item)> |
| Return < 0 if element < item , 0 if element == item , and > 0 if element > item . More...
|
|
using | ElementT = _ElementT |
|
using | MakeItemFn = std::function< QTreeWidgetItem *(const ElementT &element)> |
|
using | NameFn = std::function< std::string(const ElementT &element)> |
|
using | UpdateItemFn = std::function< bool(const ElementT &element, QTreeWidgetItem *item)> |
|
|
void | setCompareFn (CompareFn compareFn) |
|
void | setExpand (bool expand) |
|
void | setMakeItemFn (MakeItemFn makeItemFn) |
|
void | setNameFn (NameFn nameFn, int nameColumn=0) |
|
void | setUpdateItemFn (UpdateItemFn updateItemFn) |
|
| TreeWidgetBuilder ()=default |
|
| TreeWidgetBuilder (CompareFn compareFn, MakeItemFn makeItemFn, UpdateItemFn updateItemFn=NoUpdate) |
|
| TreeWidgetBuilder (const ElementT &) |
| Constructor to automatically derive the template argument. More...
|
|
| TreeWidgetBuilder (NameFn nameFn, MakeItemFn makeItemFn, UpdateItemFn updateItemFn=NoUpdate, int nameColumn=0) |
|
template<class ParentT , class ContainerT > |
void | updateTreeWithContainer (ParentT *parent, const ContainerT &elements) |
| Update the tree with the iterable container. More...
|
|
template<class ParentT , class IteratorFn > |
void | updateTreeWithIterator (ParentT *parent, IteratorFn &&iteratorFn) |
| Update the tree according to the elements iterated over by iteratorFn . More...
|
|
template<class _ElementT>
struct armarx::TreeWidgetBuilder< _ElementT >
A class to efficiently build and maintain sorted items of QTreeWidget
or QTreeWidgetItem
based on a sorted container matching the intended structure.
Definition at line 10 of file DataTreeBuilderBase.h.
◆ CompareFn
Return < 0 if element < item
, 0 if element == item
, and > 0 if element > item
.
Definition at line 25 of file TreeWidgetBuilder.h.
◆ ElementT
◆ MakeItemFn
◆ NameFn
◆ UpdateItemFn
◆ TreeWidgetBuilder() [1/4]
◆ TreeWidgetBuilder() [2/4]
Constructor to automatically derive the template argument.
Definition at line 33 of file TreeWidgetBuilder.h.
◆ TreeWidgetBuilder() [3/4]
◆ TreeWidgetBuilder() [4/4]
◆ MakeCompareNameFn()
auto MakeCompareNameFn |
( |
NameFn |
nameFn, |
|
|
int |
nameColumn |
|
) |
| |
|
static |
◆ NoUpdate()
static bool NoUpdate |
( |
const ElementT & |
element, |
|
|
QTreeWidgetItem * |
item |
|
) |
| |
|
inlinestatic |
◆ setCompareFn()
◆ setExpand()
void setExpand |
( |
bool |
expand | ) |
|
|
inline |
◆ setMakeItemFn()
◆ setNameFn()
void setNameFn |
( |
NameFn |
nameFn, |
|
|
int |
nameColumn = 0 |
|
) |
| |
|
inline |
◆ setUpdateItemFn()
◆ updateTreeWithContainer()
void updateTreeWithContainer |
( |
ParentT * |
parent, |
|
|
const ContainerT & |
elements |
|
) |
| |
Update the tree with the iterable container.
- Parameters
-
parent | The parent, i.e. the tree widget or a tree widget item. |
iteratorFn | Function taking a function bool fn(const ElementT& element) and calling it for each element in the underlying container, i.e. like: void iteratorFn(bool (*elementFn)(const ElementT& element)); |
Definition at line 312 of file TreeWidgetBuilder.h.
◆ updateTreeWithIterator()
void updateTreeWithIterator |
( |
ParentT * |
parent, |
|
|
IteratorFn && |
iteratorFn |
|
) |
| |
Update the tree according to the elements iterated over by iteratorFn
.
- Parameters
-
parent | The parent, i.e. the tree widget or a tree widget item. |
iteratorFn | Function taking a function bool fn(const ElementT& element) and calling it for each element in the underlying container, i.e. like: void iteratorFn(bool (*elementFn)(const ElementT& element)); |
Definition at line 329 of file TreeWidgetBuilder.h.
The documentation for this struct was generated from the following files: