Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SUIT_TreeModel::TreeSync Class Reference

Functor class for synchronizing data tree and tree model when the data tree is changed outside the model. More...

Public Member Functions

 TreeSync (SUIT_TreeModel *)
 Constructor. More...
 
bool isEqual (const ObjPtr &, const ItemPtr &) const
 Check if item corresponds to the specified data object. More...
 
ObjPtr nullSrc () const
 Get null data object. More...
 
ItemPtr nullTrg () const
 Get null tree item. More...
 
ItemPtr createItem (const ObjPtr &, const ItemPtr &, const ItemPtr &) const
 Create an item corresponding to the specified data object. More...
 
void updateItem (const ObjPtr &, const ItemPtr &) const
 Update tree item. More...
 
void deleteItemWithChildren (const ItemPtr &) const
 Delete item with all children recursively. More...
 
QList< ObjPtrchildren (const ObjPtr &) const
 Get all the children of the specified data object. More...
 
QList< ItemPtrchildren (const ItemPtr &) const
 Get all the children of the specified tree item. More...
 
ItemPtr parent (const ItemPtr &) const
 Get item which is the parent for the specified item. More...
 

Private Member Functions

bool needUpdate (const ItemPtr &) const
 Check if the tree item needs updating. More...
 

Private Attributes

SUIT_TreeModelmyModel
 

Detailed Description

Constructor & Destructor Documentation

SUIT_TreeModel::TreeSync::TreeSync ( SUIT_TreeModel model)
Parameters
modeltree model

Member Function Documentation

QList< SUIT_TreeModel::ObjPtr > SUIT_TreeModel::TreeSync::children ( const ObjPtr obj) const
Parameters
objdata object
Returns
list of the children

References SUIT_DataObject::children().

QList< SUIT_TreeModel::ItemPtr > SUIT_TreeModel::TreeSync::children ( const ItemPtr item) const
Parameters
itemtree item
Returns
list of the children

References SUIT_TreeModel::TreeItem::children().

SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::createItem ( const ObjPtr obj,
const ItemPtr parent,
const ItemPtr after 
) const
Parameters
objdata object
parentparent tree item
aftertree item after each new one should be inserted
Returns
created item

References SUIT_DataObject::update().

void SUIT_TreeModel::TreeSync::deleteItemWithChildren ( const ItemPtr item) const
Parameters
itemtree item
bool SUIT_TreeModel::TreeSync::isEqual ( const ObjPtr obj,
const ItemPtr item 
) const
Parameters
objdata object
itemtree item
Returns
true if item corresponds to the data object

References SUIT_TreeModel::TreeItem::dataObject(), obj, and SUIT_DataObject::root().

bool SUIT_TreeModel::TreeSync::needUpdate ( const ItemPtr item) const
private
Parameters
itemtree item to be checked
Returns
true if item needs updating
Todo:
finalize this method

References SUIT_TreeModel::TreeItem::dataObject(), and obj.

SUIT_TreeModel::ObjPtr SUIT_TreeModel::TreeSync::nullSrc ( ) const
Returns
null data object
SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::nullTrg ( ) const
Returns
null tree item
SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::parent ( const ItemPtr item) const
Parameters
itemtree item
Returns
parent item

References SUIT_TreeModel::TreeItem::parent().

void SUIT_TreeModel::TreeSync::updateItem ( const ObjPtr obj,
const ItemPtr item 
) const
Parameters
objreference data object
itemtree item to be updated

References SUIT_DataObject::update().

Member Data Documentation

SUIT_TreeModel* SUIT_TreeModel::TreeSync::myModel
private

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