2013-03-18 33 views

回答

2

看看QML Rotation项目。

您可以将旋转原点设置为您的下边框中心的Rectangle,然后在x轴上旋转。


编辑:

Rectangle { 
    id: myDock 
    width: 500 
    height: 50 
    color: "red" 

    transform: Rotation { 

    // Transform origin is the middle point of the lower border 
    origin { 
     x: myDock.width/2 
     y: myDock.height 
    } 

    axis {x: 1; y: 0; z: 0} 
    angle: 45 
    } 

} 
+0

你会这么好心发布的这一个代码段。当我试图像这个'origin.x:Item.Bottom'那样设置旋转原点时,只有矩形的右侧正确旋转。左侧是正常的? – user889329 2013-03-21 09:23:47

+0

我在上面添加了一个例子 – 2013-03-21 11:38:23

+0

感谢TheHuge_。很好地工作,我错过了将origin.y设置为矩形(或图像)的高度。 – user889329 2013-03-21 12:14:17