Skip to content

Commit

Permalink
Merge pull request #5717 from Abel032/Fix-update-folder-failure
Browse files Browse the repository at this point in the history
Fix Failure when updating the folder node
  • Loading branch information
RodneyBaker authored Jan 21, 2025
2 parents dfb10b2 + 54e2c1f commit 7a0ae5c
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions toonz/sources/toonz/filebrowsermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1295,11 +1295,30 @@ void DvDirModel::onFolderChanged(const TFilePath &path) { refreshFolder(path); }
void DvDirModel::refresh(const QModelIndex &index) {
if (!index.isValid()) return;
DvDirModelNode *node = getNode(index);
if (!node || node->getChildCount() < 1) return;
if (!node) return;

emit layoutAboutToBeChanged();
emit beginRemoveRows(index, 0, node->getChildCount() - 1);
node->refreshChildren();
emit endRemoveRows();

int oldChildren = node->getChildCount();
if (oldChildren > 0) {
emit beginRemoveRows(index, 0, oldChildren - 1);
node->refreshChildren();
emit endRemoveRows();
}
else if (oldChildren == 0) {
node->refreshChildren();
}
else {
emit layoutChanged();
return;
}

int newChildren = node->getChildCount();
if(newChildren > 0){
emit beginInsertRows(index, 0, newChildren - 1);
emit endInsertRows();
}

emit layoutChanged();
}

Expand Down

0 comments on commit 7a0ae5c

Please sign in to comment.