title: Get relative path from a file in Qt
body: <p>I am trying to get the relative path from files that I would like to write. Here a situation:</p>
  
  <p>I save a conf file in <code>D:\confs\conf.txt</code>. I have in my programs some files read from <code>D:\images\image.bmp</code>. In my <code>conf.txt</code> I would like to have <code>../images/image.bmp</code>.</p>
  
  <p>I see some useful classes like <code>QDir</code> or <code>QFileInfo</code> but I don't know what it's the best to use. I tried:</p>
  
  <pre><code>QDir dir("D:/confs");
  dir.filePath(D:/images/image.bmp) // Just return the absolute path of image.bmp
  </code></pre>
  
  <p>I read the doc and it says <code>filePath</code> only work with files in the dir set (here <code>D:\confs</code>) but I wonder if there is a way to indicate to search from a different dir and get his relative path.</p>