我想将qml项目移出应用程序窗口的左侧。 这个任务完全适用于窗口的右侧通过定义的状态这样将qml项目移出窗口左侧
states: State {
name: "hidden"
when: is_hidden == true
AnchorChanges {
target: right_item_to_move
anchors.right: undefined
}
PropertyChanges {
target: right_item_to_move
x: main_window.width
}
}
,并定义适当的过渡,我不能让它就因为负主窗口左侧的工作x坐标是不允许的。 也就是说这是行不通的:
states: State {
name: "hidden"
when: is_hidden == true
AnchorChanges {
target: left_item_to_move
anchors.left: undefined
}
PropertyChanges {
target: left_item_to_move
x: -left_item_to_move.width
}
}
我该如何实现这个任务?我正在使用Qt 5.8和QtQuick 2.0。
负的x坐标允许。请将您的示例设为[** MCVE **](https://stackoverflow.com/help/mcve),以便我们查看您的问题。 – derM
你说得对。我想我误解了文档中的某些内容,并在实现中出错。无论如何,它现在起作用了,所以感谢您指引我朝着正确的方向前进。 – KO70