Solved How works "property Item ufo: ufo" in root?
-
Hi all,
I have the next code:
import QtQuick 2.11 import QtQuick.Window 2.11 Window { id: root visible: true width: 640 height: 480 title: qsTr("Ovni") property int duration: 3000 property Item ufo: ufo //How works this here? Image { anchors.fill: parent source: "img/ufo_background.png" } ClickableImageV3 { id: ufo x: 20; y: root.height - height source: "img/ufo.png" onClicked: anim.restart() } ParallelAnimation { id: anim NumberAnimation { target: ufo properties: "y" to: 20 duration: root.duration } NumberAnimation { target: ufo properties: "x" to: 160 duration: root.duration } } //ParallelAnimation }//root
Please, anybody so kind to explain me how works "property Item ufo: ufo" in root? The program works anyway if I delete it. Which is then the purpose?
Thanks in advance
-
@Josz said in How works "property Item ufo: ufo" in root?:
Please, anybody so kind to explain me how works "property Item ufo: ufo" in root? The program works anyway if I delete it. Which is then the purpose?
If this is your main.qml, then this line has no purpose and can be safely removed. If it is not your main.qml file, then such declaration can be used to expose an internal item to a parent file (a file which includes the current one as component). For such use, however, it is better to use
alias
:property alias ufo: ufo
-
@sierdzio said in How works "property Item ufo: ufo" in root?:
your main.qml, then this line has no purpose and can be safely removed. If it is not your main.qml file, then such declaration can be used to ex
Thank you very much! A nice day.