[Qt-qml] Why can't I anchor to parent

Jason H scorp1us at yahoo.com
Tue Jul 13 01:46:06 CEST 2010


Hi again. I am trying to anchor to parent
|A    |
|    B|
|C    |

With the rect being the parent. But I get the message: "QML Text: Cannot anchor 
to a null item."


importQt4.7 
Rectangle {
	width: 1024
	height:768
	gradient: Gradient {
		GradientStop { position: 0; color: "Navy"}
		GradientStop { position: 1; color: "Black"}
	}
	//Font { id: third; family: "NiteClub"; pointSize:30; color: "White"}
	Text {
		text: "A";  font.family: "NiteClub"; font.pointSize:30; color: "White";
		anchors.top:parent.anchors.top;
		anchors.left: parent.anchors.left
	}
	Text {
		text: "B";  font.family: "NiteClub"; font.pointSize:30; color: "White";
		anchors.verticalCenter:parent.anchors.verticalCenter;
		anchors.right:parent.anchors.right
	}
	Text {
		text: "C";  font.family: "NiteClub"; font.pointSize:30; color: "White";
		anchors.bottom:parent.anchors.bottom;
		anchors.left:parent.anchors.left
	}
}


      




More information about the Qt-qml mailing list