Warning, /webapps/qmlonline/qml/examples/anchorchanges.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.0 0002 0003 Rectangle { 0004 id: root 0005 anchors.fill: parent 0006 color: "black" 0007 0008 Rectangle { 0009 id: rect 0010 width: 50 0011 height: 50 0012 color: "red" 0013 anchors.top: root.top 0014 anchors.left: root.left 0015 anchors.margins: 10 0016 } 0017 0018 states: [ 0019 State { 0020 name: "small" 0021 AnchorChanges { 0022 target: rect 0023 anchors.bottom: root.bottom 0024 anchors.right: root.right 0025 } 0026 PropertyChanges { 0027 target: rect 0028 height: 50 0029 width: 50 0030 } 0031 }, 0032 State { 0033 name: "big" 0034 AnchorChanges { 0035 target: rect 0036 anchors.bottom: undefined 0037 anchors.right: undefined 0038 } 0039 } 0040 ] 0041 0042 Timer { 0043 running: true; repeat: true; interval: 1000; 0044 onTriggered: root.state = root.state === "small" ? "big" : "small" 0045 } 0046 0047 transitions: Transition { 0048 AnchorAnimation { duration: 400 } 0049 } 0050 }