diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-02-07 10:52:49 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-02-07 10:52:49 -0500 |
| commit | 41e6189be431dbd41b9d41751b01708df06a9610 (patch) | |
| tree | e6b759bc49ff156caba12654b2e76b44c26626da /src/filetree.cpp | |
| parent | 49a1e234ef35e34f92c6be6c95cb88b8b498245f (diff) | |
disconnect any proxies when fully loading
disable model when resetting, enable it back after the directory refresh so the tree doesn't appear in a weird state in between
Diffstat (limited to 'src/filetree.cpp')
| -rw-r--r-- | src/filetree.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/filetree.cpp b/src/filetree.cpp index 4316021a..af6ef70b 100644 --- a/src/filetree.cpp +++ b/src/filetree.cpp @@ -157,7 +157,28 @@ void FileTree::clear() void FileTree::ensureFullyLoaded() { + QAbstractProxyModel* proxy = nullptr; + + if (m_tree->model() != m_model) { + // looks like there's a proxy on the tree, disable it + proxy = dynamic_cast<QAbstractProxyModel*>(m_tree->model()); + + m_tree->setModel(m_model); + + if (proxy) { + if (proxy->sourceModel() != m_model) + DebugBreak(); + + proxy->setSourceModel(nullptr); + } + } + m_model->ensureFullyLoaded(); + + if (proxy) { + proxy->setSourceModel(m_model); + m_tree->setModel(proxy); + } } FileTreeItem* FileTree::singleSelection() |
