我想將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