Trouble with anchors
Solved
General and Desktop
-
I am attempting to create a text box which will display the value the user is entering inside of the keyboard:
Row { id: idFlowDigitsEntryBox width: (keyWidth * 3 + keySpacing * 2) * 2 height: 50 anchors.bottom: idFlowDigits.top anchors.leftMargin: keySpacing spacing: keySpacing Rectangle { id: display color: "white" width: parent.width height: keyHeight radius: 5 Text //<- error's on this line { id: entryDisplay width: parent.width - 50 anchors.centerIn: idFlowDigitsEntryBox color: "black" } } }
error:
QML QQuickText: Cannot anchor to an item that isn't a parent or sibling.
Why am I getting this error, any ideas?
-
The error message is clear - you should anchor to parent, not grand parent. Change your code to:
anchors.centerIn: parent
And the error will go away.