Qt Code:
  1. import QtQuick 2.8
  2. import QtQuick.Window 2.2
  3.  
  4. import QtQuick.Layouts 1.1
  5. import QtQuick.Controls 1.4
  6. import QtQuick.Controls 2.1
  7.  
  8. Window
  9. {
  10. id: head
  11. visible: true
  12. width: 640
  13. height: 480
  14. title: qsTr("Hello World")
  15.  
  16. Loader
  17. {
  18. id: loader
  19. }
  20.  
  21. Component
  22. {
  23. id: rect
  24.  
  25. Window
  26. {
  27. id: ppp
  28.  
  29. visible: true
  30. width: 164
  31. height: 148
  32. title: qsTr("Hello World")
  33. }
  34. }
  35.  
  36. Rectangle
  37. {
  38. anchors.fill: parent
  39. color: "blue"
  40. Rectangle
  41. {
  42. id: leftArea
  43.  
  44. height: 100
  45. width: 100
  46. color: "red"
  47.  
  48. MouseArea
  49. {
  50. anchors.fill: parent
  51. onClicked:
  52. {
  53. loader.sourceComponent = rect
  54. leftArea.parent = loader
  55. }
  56. }
  57. }
  58. }
To copy to clipboard, switch view to plain text mode 

When I click on that rectangle, it disapears but it doesn't get shown in the loader's window.
Moreover when I maximize the new resultant window the GUI hangs.

Aim is to make the new Loader's window the parent of the rectangle on click.