From a6cb326ae42f0d1b5ed06ad06e9babdfedb18f04 Mon Sep 17 00:00:00 2001 From: Martin van Zijl Date: Fri, 27 Mar 2020 12:51:09 +1300 Subject: [PATCH] Improve Browser up button. When it cannot go up the treeview, try going to parent directory. --- toonz/sources/toonz/filebrowser.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp index 5c40d47f..d3d677c9 100644 --- a/toonz/sources/toonz/filebrowser.cpp +++ b/toonz/sources/toonz/filebrowser.cpp @@ -2196,7 +2196,14 @@ void FileBrowser::refresh() { void FileBrowser::folderUp() { QModelIndex index = m_folderTreeView->currentIndex(); - if (!index.isValid() || !index.parent().isValid()) return; + if (!index.isValid() || !index.parent().isValid()) { + // cannot go up tree view, so try going to parent directory + TFilePath parentFp = m_folder.getParentDir(); + if (parentFp != TFilePath("") && parentFp != m_folder) { + setFolder(parentFp, true); + } + return; + } m_folderTreeView->setCurrentIndex(index.parent()); m_folderTreeView->scrollTo(index.parent()); }