How a QML file considers a parent?
I have a qml file where there is a property declared as below:
property KeyboardManager keyManager: parent ? parent.manager : null
where KeyboardManager is a cpp class inherited in qml. unable to find what exactly this line means. Request to clarify.
Thanks in advance.
@Nitheesh Parent is the visual parent of an Item-based object (http://doc.qt.io/qt-5/qtquick-visualcanvas-visualparent.html). When you write your own component which can be re-used in many contexts you don't know what the parent is or if there even is one at all. So this line checks if the created object has a 'parent' and sets your object's keyboard manager property object accordingly - it's either the parent's manager, or null if there's no parent. This will lead to an error if the object has a parent but this parent doesn't have the 'manager' property.