fix crash when directory is changed

master
an 2019-10-08 23:58:52 -04:00
parent 881fa8c9bd
commit ed5f825b5a
1 changed files with 9 additions and 3 deletions

View File

@ -98,9 +98,9 @@ namespace Arc {
return Qt::NoItemFlags;
} else {
return Qt::ItemIsSelectable |
Qt::ItemIsDragEnabled |
Qt::ItemIsEnabled |
Qt::ItemNeverHasChildren;
Qt::ItemIsDragEnabled |
Qt::ItemIsEnabled |
Qt::ItemNeverHasChildren;
}
}
@ -145,6 +145,12 @@ namespace Arc {
void Model::setDir(Dir *dir) {
if(dir != m_dir) {
emit layoutAboutToBeChanged();
for(int row = 0, rows = rowCount(); row < rows; row++) {
for(int col = 0, cols = columnCount(); col < cols; col++) {
changePersistentIndex(index(row, col), QModelIndex{});
}
}
m_dir = dir;
emit layoutChanged();
emit dirChanged(dir);