【发布时间】:2017-05-31 10:32:13
【问题描述】:
我想将一个 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 坐标。 IE。这不起作用:
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,以便我们调查您的问题。
-
你是对的。我想我误读了文档中的某些内容,并且在实现中出现了问题。无论如何,它现在可以工作了,所以谢谢你指出我正确的方向。