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< ObjPtr > | children (const ObjPtr &) const |
Get all the children of the specified data object. More... | |
QList< ItemPtr > | children (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_TreeModel * | myModel |
SUIT_TreeModel::TreeSync::TreeSync | ( | SUIT_TreeModel * | model | ) |
model | tree model |
QList< SUIT_TreeModel::ObjPtr > SUIT_TreeModel::TreeSync::children | ( | const ObjPtr & | obj | ) | const |
QList< SUIT_TreeModel::ItemPtr > SUIT_TreeModel::TreeSync::children | ( | const ItemPtr & | item | ) | const |
item | tree item |
References SUIT_TreeModel::TreeItem::children().
SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::createItem | ( | const ObjPtr & | obj, |
const ItemPtr & | parent, | ||
const ItemPtr & | after | ||
) | const |
obj | data object |
parent | parent tree item |
after | tree item after each new one should be inserted |
References SUIT_DataObject::update().
item | tree item |
obj | data object |
item | tree item |
true
if item corresponds to the data object References SUIT_TreeModel::TreeItem::dataObject(), obj, and SUIT_DataObject::root().
item | tree item to be checked |
true
if item needs updatingReferences SUIT_TreeModel::TreeItem::dataObject(), and obj.
SUIT_TreeModel::ObjPtr SUIT_TreeModel::TreeSync::nullSrc | ( | ) | const |
SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::nullTrg | ( | ) | const |
SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::parent | ( | const ItemPtr & | item | ) | const |
obj | reference data object |
item | tree item to be updated |
References SUIT_DataObject::update().
|
private |