2012-02-25 29 views
2

有一些定义让我困惑......我发现文本的anchors.baseline与Rectangle的不同..为什么?基线的定义是什么?谢谢...anchors.baseline在QML中

Item { 
    width: 400; height: 200 

    Rectangle { 
     y:20 
     id: rectangle 
     width: 80; height: 80 
     color: "red" 
    } 

    Text { 
     text: "Hello World!" 
     anchors.baseline: rectangle.baseline 
     anchors.left: rectangle.right 
    } 
} 

enter image description here 长方形的基线之上,文字的基线是底?

回答

6

基线对应于文字所在的假想线。对于没有文字的项目,它与顶部相同。

+0

耶!感谢您的帮助......还有另外一个问题,您能帮助我吗? – 2012-02-25 10:00:08

+0

http://stackoverflow.com/questions/9443053/some-exercise-about-qml你会帮我吗?谢谢.. – 2012-02-25 10:06:58