MapTreeWidgetBuilder< KeyT, ValueT > Struct Template Reference

A class to efficiently build and maintain sorted items of QTreeWidget or QTreeWidgetItem based on a map matching the intended structure. More...

#include <RobotAPI/libraries/armem_gui/util/TreeWidgetBuilder.h>

Public Types

using Base = TreeWidgetBuilder<typename MapT::value_type>
 
using CompareFn = std::function<int(const ElementT& element, QTreeWidgetItem* item)>
 
using ElementT = typename Base::ElementT
 
using MakeItemFn = std::function<QTreeWidgetItem*(const KeyT& key, const ValueT& value)>
 
using MapT = std::map<KeyT, ValueT>
 
using NameFn = std::function<std::string(const KeyT& key, const ValueT& value)>
 
using UpdateItemFn
 

Public Member Functions

 MapTreeWidgetBuilder ()
 
 MapTreeWidgetBuilder (const MapT &)
 Allows declaring instance from container without explicit template arguments.
 
 MapTreeWidgetBuilder (MakeItemFn makeItemFn, UpdateItemFn updateItemFn=NoUpdate)
 
 MapTreeWidgetBuilder (NameFn nameFn, MakeItemFn makeItemFn, UpdateItemFn updateItemFn=NoUpdate)
 
void setCompareFn (CompareFn compareFn)
 
void setExpand (bool expand)
 
void setMakeItemFn (MakeItemFn makeItemFn)
 
void setNameFn (NameFn nameFn)
 
void setUpdateItemFn (UpdateItemFn updateItemFn)
 
template<class ParentT>
void updateTree (ParentT *tree, const MapT &elements)
 

Static Public Member Functions

static std::string KeyAsName (const KeyT &key, const ValueT &value)
 A name function using the key as name.
 
static bool NoUpdate (const KeyT &key, const ValueT &value, QTreeWidgetItem *item)
 No update function (default).
 

Detailed Description

template<class KeyT, class ValueT>
struct armarx::MapTreeWidgetBuilder< KeyT, ValueT >

A class to efficiently build and maintain sorted items of QTreeWidget or QTreeWidgetItem based on a map matching the intended structure.

Definition at line 137 of file TreeWidgetBuilder.h.

Member Typedef Documentation

◆ Base

template<class KeyT, class ValueT>
using Base = TreeWidgetBuilder<typename MapT::value_type>

Definition at line 140 of file TreeWidgetBuilder.h.

◆ CompareFn

template<class KeyT, class ValueT>
using CompareFn = std::function<int(const ElementT& element, QTreeWidgetItem* item)>

Definition at line 143 of file TreeWidgetBuilder.h.

◆ ElementT

template<class KeyT, class ValueT>
using ElementT = typename Base::ElementT

Definition at line 141 of file TreeWidgetBuilder.h.

◆ MakeItemFn

template<class KeyT, class ValueT>
using MakeItemFn = std::function<QTreeWidgetItem*(const KeyT& key, const ValueT& value)>

Definition at line 146 of file TreeWidgetBuilder.h.

◆ MapT

template<class KeyT, class ValueT>
using MapT = std::map<KeyT, ValueT>

Definition at line 139 of file TreeWidgetBuilder.h.

◆ NameFn

template<class KeyT, class ValueT>
using NameFn = std::function<std::string(const KeyT& key, const ValueT& value)>

Definition at line 144 of file TreeWidgetBuilder.h.

◆ UpdateItemFn

template<class KeyT, class ValueT>
using UpdateItemFn
Initial value:
std::function<bool(const KeyT& key, const ValueT& value, QTreeWidgetItem* item)>

Definition at line 147 of file TreeWidgetBuilder.h.

Constructor & Destructor Documentation

◆ MapTreeWidgetBuilder() [1/4]

template<class KeyT, class ValueT>
MapTreeWidgetBuilder ( )
inline

Definition at line 150 of file TreeWidgetBuilder.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MapTreeWidgetBuilder() [2/4]

template<class KeyT, class ValueT>
MapTreeWidgetBuilder ( const MapT & )
inline

Allows declaring instance from container without explicit template arguments.

Definition at line 156 of file TreeWidgetBuilder.h.

+ Here is the call graph for this function:

◆ MapTreeWidgetBuilder() [3/4]

template<class KeyT, class ValueT>
MapTreeWidgetBuilder ( MakeItemFn makeItemFn,
UpdateItemFn updateItemFn = NoUpdate )
inline

Definition at line 160 of file TreeWidgetBuilder.h.

+ Here is the call graph for this function:

◆ MapTreeWidgetBuilder() [4/4]

template<class KeyT, class ValueT>
MapTreeWidgetBuilder ( NameFn nameFn,
MakeItemFn makeItemFn,
UpdateItemFn updateItemFn = NoUpdate )
inline

Definition at line 167 of file TreeWidgetBuilder.h.

+ Here is the call graph for this function:

Member Function Documentation

◆ KeyAsName()

template<class KeyT, class ValueT>
static std::string KeyAsName ( const KeyT & key,
const ValueT & value )
inlinestatic

A name function using the key as name.

Definition at line 230 of file TreeWidgetBuilder.h.

+ Here is the caller graph for this function:

◆ NoUpdate()

template<class KeyT, class ValueT>
static bool NoUpdate ( const KeyT & key,
const ValueT & value,
QTreeWidgetItem * item )
inlinestatic

No update function (default).

Definition at line 247 of file TreeWidgetBuilder.h.

+ Here is the caller graph for this function:

◆ setCompareFn()

template<class KeyT, class ValueT>
void setCompareFn ( CompareFn compareFn)
inline

Definition at line 188 of file TreeWidgetBuilder.h.

◆ setExpand()

template<class KeyT, class ValueT>
void setExpand ( bool expand)
inline

Definition at line 216 of file TreeWidgetBuilder.h.

◆ setMakeItemFn()

template<class KeyT, class ValueT>
void setMakeItemFn ( MakeItemFn makeItemFn)
inline

Definition at line 194 of file TreeWidgetBuilder.h.

+ Here is the caller graph for this function:

◆ setNameFn()

template<class KeyT, class ValueT>
void setNameFn ( NameFn nameFn)
inline

Definition at line 177 of file TreeWidgetBuilder.h.

+ Here is the caller graph for this function:

◆ setUpdateItemFn()

template<class KeyT, class ValueT>
void setUpdateItemFn ( UpdateItemFn updateItemFn)
inline

Definition at line 205 of file TreeWidgetBuilder.h.

+ Here is the caller graph for this function:

◆ updateTree()

template<class KeyT, class ValueT>
template<class ParentT>
void updateTree ( ParentT * tree,
const MapT & elements )
inline

Definition at line 223 of file TreeWidgetBuilder.h.

+ Here is the caller graph for this function:

The documentation for this struct was generated from the following file: