|
|
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/util/TreeWidgetBuilder.h>
Public Types | |
| using | CompareFn = std::function<int(const ElementT& element, QTreeWidgetItem* item)> |
Return < 0 if element < item, 0 if element == item, and > 0 if element > item. | |
| 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)> |
Public Member Functions | |
| 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. | |
| 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. | |
| template<class ParentT, class IteratorFn> | |
| void | updateTreeWithIterator (ParentT *parent, IteratorFn &&iteratorFn) |
Update the tree according to the elements iterated over by iteratorFn. | |
Static Public Member Functions | |
| static CompareFn | MakeCompareNameFn (NameFn nameFn, int nameColumn) |
| Uses the name for comparison. | |
| static bool | NoUpdate (const ElementT &element, QTreeWidgetItem *item) |
| No update function (default). | |
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 19 of file TreeWidgetBuilder.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.
Definition at line 24 of file TreeWidgetBuilder.h.
| using ElementT = _ElementT |
Definition at line 21 of file TreeWidgetBuilder.h.
| using MakeItemFn = std::function<QTreeWidgetItem*(const ElementT& element)> |
Definition at line 26 of file TreeWidgetBuilder.h.
Definition at line 25 of file TreeWidgetBuilder.h.
| using UpdateItemFn = std::function<bool(const ElementT& element, QTreeWidgetItem* item)> |
Definition at line 27 of file TreeWidgetBuilder.h.
|
default |
|
inline |
Constructor to automatically derive the template argument.
Definition at line 33 of file TreeWidgetBuilder.h.
|
inline |
Definition at line 37 of file TreeWidgetBuilder.h.
|
inline |
Definition at line 44 of file TreeWidgetBuilder.h.
Uses the name for comparison.
Definition at line 346 of file TreeWidgetBuilder.h.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
No update function (default).
Definition at line 113 of file TreeWidgetBuilder.h.
|
inline |
|
inline |
Definition at line 79 of file TreeWidgetBuilder.h.
|
inline |
|
inline |
|
inline |
| void updateTreeWithContainer | ( | ParentT * | parent, |
| const ContainerT & | elements ) |
Update the tree with the iterable container.
| 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 355 of file TreeWidgetBuilder.h.
Here is the call graph for this function:
Here is the caller graph for this function:| void updateTreeWithIterator | ( | ParentT * | parent, |
| IteratorFn && | iteratorFn ) |
Update the tree according to the elements iterated over by iteratorFn.
| 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 374 of file TreeWidgetBuilder.h.
Here is the caller graph for this function: