I created a app directory browser using QListView, to display my desktop items.
The following is my "file-opening" function:

Qt Code:
  1. void MainWindow::click2(const QModelIndex &var/*index*/)
  2. {
  3. QString o = var.data(0).toString();
  4.  
  5. qDebug() << o;
  6. qDebug() << QDesktopServices::openUrl(o);
  7. }
To copy to clipboard, switch view to plain text mode 

So with that and my index set as current directory, I can open any file.But if I change its index to any other directory thats not its current, it fails and qDebug says :
qDebug() << QDesktopServices:penUrl(o); --> --> false

I did some testing and passing this:

Qt Code:
  1. QUrl dir = directory+"\\"+var.data(0).toString();
  2. qDebug() << QDesktopServices::openUrl(dir);
To copy to clipboard, switch view to plain text mode 

still gives me:
qDebug() << QDesktopServices:penUrl(dir); --> --> false

Any idea why?