title: Qml FileDialog is rendering behind main window with QQuickWidget (QT 5.9.1)
body: <p>I am building a desktop application using <em>QML</em> with <em>QQuickWidget</em> and <em>QMainWindow</em>, everything looks work fine except to the <em>FileDialog</em>. When I open a window using <em>FileDialog</em> it works flawlessly at first time but in the second time and so on the <em>FileDialog</em> window is rendered behind the main window, preventing the user to choose a file, it is just possible to choose a file after click on the "choose window" (that bring it forward). If the application is in fullscreen mode it is not possible to realize that the <em>FileDialog</em> window is opened.
  It just happen when I use <em>QQuickWidget</em> and <em>QMainWindow</em>, if I create a project with <em>QGuiApplication</em> (without <em>QQuickWidget</em> and <em>QMainWindow</em>) I don't have any problems with <em>FileDialog</em> behavior. Some idea how can I make <em>FileDialog</em> work properly with <em>QQuickWidget</em>?</p>
  
  <p>FileDialog code:</p>
  
  <pre><code>/*uncomment ApplicationWindow and comment the rectangle component to right behavior*/
  /*
  ApplicationWindow{
  height: 600
  width: 800 
  */
  
  Rectangle {
  id: rect
  visible: true
  
  Button{
      id:open
      height: 40
      onClicked: fileDialog.open()
      text: "open dialog"
  }
  
  FileDialog {
  
      id: fileDialog
      modality: Qt.ApplicationModal
      title: "FileDialogTest"
      nameFilters: [ "Zip Files (*.zip )", "All files (*)" ]
      selectedNameFilter: "All files (*)"
      selectFolder: false
      onAccepted: {
          console.log("Accepted")
      }
      onRejected: {
          console.log("Rejected")
      }
  }
  //}
  </code></pre>
  
  <p>Main.cpp</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
   /*##### This block make fileDialog work properly #####*/
  
   /*
   QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
   QGuiApplication app(argc, argv);
  
   QQmlApplicationEngine engine;
   engine.load(QUrl(QLatin1String("qrc:/main.qml")));
   if (engine.rootObjects().isEmpty())
       return -1;
   */
  
  
   /*#### This block make openDialog work have weird behavior ####*/
   /* Should be commented when the previous block is uncomment */
  
   QApplication app(argc, argv);
   QMainWindow mainWindow;
   QQuickWidget *quickWidget = new QQuickWidget;
   quickWidget-&gt;setMinimumSize(800, 600);
   quickWidget-&gt;setResizeMode(QQuickWidget::SizeRootObjectToView);
  
   quickWidget-&gt;setSource(QUrl("qrc:/main.qml"));
   mainWindow.setCentralWidget(quickWidget);
   mainWindow.show();
  
   return app.exec();
  }
  </code></pre>
  
  <p>I made a simple example of my problems it can be download by  <a href="https://drive.google.com/file/d/1B_qtSZnigrLtDMHS0-84mOrFe5t2ZVIj/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1B_qtSZnigrLtDMHS0-84mOrFe5t2ZVIj/view?usp=sharing</a> and can be run on QtCreator to illustrate my problem.</p>