Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Improve Browser up button.

Martin van Zijla6cb326ae42f
diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp
index 5c40d47f4..d3d677c95 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());
}