title: Getting access to filepath with QFileSystemModel
body: <p>I have a <code>QFileSystemModel</code> within a <code>QListView</code> that allows me to select items within the file system.</p>
  
  <p>When I select an item, I want to return the filepath in a <code>QMessageBox</code>.</p>
  
  <p>So far I have the following code:</p>
  
  <pre><code>filemodel = new QFileSystemModel(this);
  filemodel-&gt;setFilter(QDir::NoDotAndDotDot | QDir::Files);
  filemodel-&gt;setNameFilters(filters);
  filemodel-&gt;setNameFilterDisables(false);
  filemodel-&gt;setRootPath(sPath);
  
  //get file path
  QString filepath = filemodel-&gt;fileName(index);
  QMessageBox::information(this, "title", filepath);
  
  ui-&gt;listView-&gt;setModel(filemodel);
  </code></pre>
  
  <p>This creates the filemodel.</p>
  
  <p>I'm getting this error:</p>
  
  <blockquote>
    <p>mainwindow.cpp:46: error: no matching function for call to 'QFileSystemModel::fileName(char* (&amp;)(const char*, int))'</p>
  </blockquote>
  
  <p>Is this the correct way to go about this? Returning the filepath when an item is selected?</p>
  
  <p>EDIT @dunc123</p>
  
  <p>In constructor:</p>
  
  <pre><code>connect(ui-&gt;listView-&gt;selectionModel(), SIGNAL(selectionChanged(const QItemSelection &amp;, const QItemSelection &amp;)), this, SLOT(selectedFile(QItemSelection one, QItemSelection two)));
  </code></pre>
  
  <p>selectedFile:</p>
  
  <pre><code>void MainWindow::selectedFile(QItemSelection one, QItemSelection two){
      QString file_name = filemodel-&gt;fileName(ui-&gt;listView-&gt;selectionModel()-&gt;currentIndex());
      QMessageBox::information(this, "title", file_name);
  }
  </code></pre>
  
  <p>It builds and runs but when I click on a file, I get the following error:</p>
  
  <pre><code>Object::connect: No such slot MainWindow::selectedFile(QItemSelection one, QItemSelection two) in ../Images/mainwindow.cpp:26
  </code></pre>
  
  <p>Object::connect:  (receiver name: 'MainWindow')</p>
  
  <p>I'm assuming the way I pass the variables is wrong?</p>
  
  <p>Could you help me out?</p>