Solved How can i delete a rectangle (without using visible property)
-
Hi guys
I want to delete rect_one when I click on rect_two and I don't have to use visible property.code:
import QtQuick 2.9 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: rect_one color:"RED" height:100 width:100 } Rectangle { id:rect_two color:"Blue" height:100 width:100 x:300 MouseArea { anchors.fill:parent onClicked:{//Here what should i write to delete rect_one and i dont want to use visible property} } } } }
What is the way to do this?
Thanks
Ashish Ajgaonkar -
@ashajg hi you can call
destroy()
but doc states you should avoid deleting objects that you did not dynamically create yourself
see also opacity
-
hi @LeLev
Thank you it worked!!!!