qt - QML: Unable to assign QQuickItem to QQuickAnchorLine -


this question has answer here:

i'm trying position item id containeritem in main window id mainwindow in main.qml file. i've got message in output:

unable assign qquickwindowqmlimpl qquickitem

the message points on string anchors.fill: mainwindow. code:

import qtquick 2.4 import qtquick.window 2.2  window {      visible: true     color: "black"     id : mainwindow      width: 360     height: 360      item {          anchors.fill: mainwindow          id: containeritem     } } 

i'll grateful help!

window (qquickwindow) specific. if call child parent (anchors.fill:parent), receive qquickrootitem, if use id, in example, receive qquickwindowqmlimpl. if want use anchors.fill children, use window parent. p.s. window hasn't anchors @ all, , if want stick right in example, must calculate width of window , object want stick, or can wrap object filled item.

example:

import qtquick 2.4 import qtquick.window 2.2  window {     id : mainwindow     visible: true     color: "black"     width: 360     height: 360      item {         id: containeritem         anchors.fill: parent         rectangle {             anchors {                 right:parent.right                 bottom:parent.bottom             }             width: 80             height: 80             color: "pink"         }     } } 

Comments