import QtQuick 2.5 import QtQuick.Window 2.2 import QtQuick.Controls 1.2 import QtMultimedia 5.4 ApplicationWindow { id: window property Window other visible: true width: 640 height: 960 MouseArea { anchors { fill: parent } onClicked: timer.running = !timer.running } Timer { id: timer repeat: true interval: 1500 onTriggered: { if (!window.other) { window.other = test.createObject(null); return } if (window.other) { window.other.destroy() window.other = null gc() } } } Component { id: test Window { color: "red"; visible: true; width: 64; height: 96 } } }