title: C++ - QFileDialog opens additional non-handled windows
body: <p>I have an issue using the static member functions of QFileDialog. When the file explorer dialog opens, another window is opened in background, but contains nothing : it isn't just painted. It closes when I select something and close the file dialog but it remains annoying.</p>
  
  <p>I'd like to get rid of it. I read an existing <a href="https://stackoverflow.com/questions/20557285/qfiledialog-opens-a-second-possibly-parent-unwanted-window/26077860" title="QFileDialog opens a second (possibly parent) unwanted window">thread</a> about this issue that suggested to give a parent for the dialog as argument to the function. So I used a very simple parent widget :</p>
  
  <pre><code>QString str = QFileDialog::getOpenFileName(new QWidget(),trUtf8("Choose a file"));
  </code></pre>
  
  <p>And then I had no more one annoying window, but two. The first one was closed when I closed the file explorer dialog, but the second one remained until I closed the application.</p>
  
  <p>I think the second window was the QWidget I gave as parent. The default value for the first argument is 0, but maybe Qt creates a QWidget() in this case.</p>
  
  <p>I tried to create an independant QWidget and hide it before calling getOpenFileName() :</p>
  
  <pre><code>QWidget *w = new QWidget();
  w-&gt;hide();
  QString str = QFileDialog::getOpenFileName(w,trUtf8("Choose a file"));
  </code></pre>
  
  <p>But it doesn't change anything, and I still get two unwanted windows. At last, I tried to use a QLabel as parent to see if it was really shown :</p>
  
  <pre><code>QLabel *l = new QLabel("Test");
  QString str = QFileDialog::getOpenFileName(l,trUtf8("Choose a file"));
  </code></pre>
  
  <p>But it seems it is not. Obviously nothing is handling those windows... they aren't just painted, when you move a window on them, you can see the trace it leaves.</p>
  
  <p>I ran out of ideas... does anyone have any other idea to solve that annoying problem ?</p>