title: Get root index for QTreeView and go back up one level
body: <p>I use <code>QTreeView</code> and <code>QFileSystemModel</code> to make a very simple file explorer. Now the <code>QTreeView</code> can get confusing with it's cascading structure:</p>
  
  <p><img src="https://i.stack.imgur.com/c0Wa4.png" alt="image description"></p>
  
  <p>This is added an option to set selected directory as root location temporary:</p>
  
  <p><img src="https://i.stack.imgur.com/Vxa0w.png" alt="image description"></p>
  
  <p>In in the code, this is the method that will set root node to <code>QTreeView</code> by given path. At this moment I don't know how to check on invalid paths:</p>
  
  <pre><code>void FileView::setRootPath( const QString&amp;str )
  {
      // This didn't work
      //model-&gt;setRootPath(str);
      //This works
      ui.treeView-&gt;setRootIndex(model-&gt;index(str));
  }
  </code></pre>
  
  <p>But I also want to be able to revert this oparation and go back up the directory tree. What I think I need is to get some code under following comment line:</p>
  
  <pre><code>void FileView::rootUpOneLevel() {
      QString rootPath;
      // Get the current root index path into the QString
       ...
      // Set the path as new root index, provided it's not out of the original root
      setRootPath(rootPath);
  }
  </code></pre>