Commit e6069d8b authored by hjk's avatar hjk Committed by hjk

TreeModel: Introduce a recursive TreeItem::updateAll() function

Useful in cases where e.g. siblings are affected (e.g. font
changes to indicate active items).

Change-Id: Ib2f8018688d00bd682bb6aaff08156f0be04f5dc
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 20ec978b
......@@ -730,6 +730,16 @@ void TreeItem::update()
}
}
void TreeItem::updateAll()
{
if (m_model) {
QModelIndex idx = index();
m_model->dataChanged(idx, idx.sibling(idx.row(), m_model->m_columnCount - 1));
foreach (TreeItem *item, m_children)
item->updateAll();
}
}
void TreeItem::updateColumn(int column)
{
if (m_model) {
......
......@@ -57,6 +57,7 @@ public:
void removeChildren();
void sortChildren(const std::function<bool(const TreeItem *, const TreeItem *)> &cmp);
void update();
void updateAll();
void updateColumn(int column);
void expand();
TreeItem *firstChild() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment