fix crash when directory is changed
This commit is contained in:
parent
881fa8c9bd
commit
ed5f825b5a
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user