qt - QML Dynamically created object lifetime -


When I came into some strange behavior, I am testing a custom popup menu strategy: Dynamically Ignored the request to remove the created popup window.

window {id: window width: 400 height: 400 color: "red" rectangle {id: base width: 100 height: 100 anchor. Center: Original Color: Basic window of the "green" property window: window property window popup: tap mouse arrowa {anchor. Fill: Surprise at parents: {base.popup = popupComp.createObject (zero, {"parent window": base.parentWindow}); }} Connection {target: base.parentWindow onClosing: {if (base.popup! == faucet) {base.popup.hide ()); Base.popup.destroy (); //}}} component {id: popup comp window {width: 150 height: 150x: parent Windows XP, base.mapToItem (zero, 0, 0) .xy: parentWindow.y + base.mapToItem (zero , 0, Base.height). O flags: Qt. Popup color: "blue" is showing: True Property Window Parentwondo: Faucet Component. On: The Request Activate () component. Redirect: {console.log ("delete popup"); } Onactive Chenned: {if (active!) Console.log ("popup idle"); to conceal(); Base.popup = null; Destroyed (); //}}}}}}

I have to create a popup window dynamically because no one is the only way to specify the origin, as if a sub-window (i.e. one Parent window) QWindow :: active state seems to depend on her parents.

When the popup window is closed, the delete () slot of the popup is called via the OnActive Spry handler - but the Off () The object is not destroyed until the signal is emitted. Popup idle qml: popup is idle / closing original window now qml: popup delete qml delete popup 2 When Calling 1

I can say that there is something to do with it, so far Not ready to take action on the call.

With the lines of this conjecture, there is a decent solution:

  thisWindow.destroy (1);  

Comments