title: Close QT Child Window and open again controls are gone
body: <p>I’m a newbie, and I’m trying to get a child window to work. I followed after the controls gallery example, and it doesn’t work right, in my opinion. When you click the button to show the child window, it works fine, and if you click the button that says close it does window1.visible = false, which works fine.</p>
  
  <p>However, if instead of clicking the button you close the window using the x box on the window, it destroys the window and if you try to open it again it displays a window, but the controls are missing.</p>
  
  <p>This program initializes the child window before at the beginning of main.qml. It seems to me that if I initialized the window when I actually click the button, that would work, but I can’t figure out how to do it.</p>
  
  <p>Any ideas?</p>
  
  <p>Here's the code sample:</p>
  
  <pre><code>import QtQuick 2.2
  import QtQuick.Controls 1.1
  import QtQuick.Window 2.0
  
  ApplicationWindow {
      title: qsTr("Child Window")
      width: 640
      height: 480
  
      menuBar: MenuBar {
          Menu {
              title: qsTr("File")
              MenuItem {
                  text: qsTr("Exit")
                  onTriggered: Qt.quit();
              }
          }
      }
      Window {
          id: window1
  
          width: 200
          height: 200
  
          title: "child window"
          flags: Qt.Dialog
  
          Rectangle {
              color: syspal.window
              anchors.fill: parent
  
              Text {
                  id: dimensionsText
                  anchors.horizontalCenter: parent.horizontalCenter
                  anchors.top: parent.top
                  width: parent.width
                  horizontalAlignment: Text.AlignHCenter
              }
  
              Text {
                  id: availableDimensionsText
                  anchors.horizontalCenter: parent.horizontalCenter
                  anchors.top: dimensionsText.bottom
                  width: parent.width
                  horizontalAlignment: Text.AlignHCenter
              }
  
              Text {
                  id: closeText
                  anchors.horizontalCenter: parent.horizontalCenter
                  anchors.top: availableDimensionsText.bottom
                  text: "Child Window Test"
              }
              Button {
                  anchors.horizontalCenter: closeText.horizontalCenter
                  anchors.top: closeText.bottom
                  id: closeWindowButton
                  text:"Close"
                  width: 98
                  tooltip:"Press me, to close this window again"
                  onClicked: window1.visible = false
              }
          }
      }
  
  
      Button {
          text: qsTr("Open Child Window")
          anchors.centerIn: parent
          onClicked: {
              window1.visible = !window1.visible
          }
      }
  }
  </code></pre>
  
  <p>If you click on the button in the child window to close it, it works fine. If you click on the x in the corner to close the window, it closes it but next time you open it the control (close window button and text) are not visible.</p>