diff options
Diffstat (limited to 'tests/auto/qml/qmldesigner/data/merging/ButtonAbsoluteTemplate.qml')
-rw-r--r-- | tests/auto/qml/qmldesigner/data/merging/ButtonAbsoluteTemplate.qml | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/auto/qml/qmldesigner/data/merging/ButtonAbsoluteTemplate.qml b/tests/auto/qml/qmldesigner/data/merging/ButtonAbsoluteTemplate.qml new file mode 100644 index 0000000000..88d66014ac --- /dev/null +++ b/tests/auto/qml/qmldesigner/data/merging/ButtonAbsoluteTemplate.qml @@ -0,0 +1,104 @@ +import QtQuick 2.10 +import QtQuick.Templates 2.1 as T + +T.Button { + id: control + + implicitWidth: Math.max( + background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max( + background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + leftPadding: 4 + rightPadding: 4 + + text: "My Button" + + background: Item { + implicitWidth: buttonNormal.width + implicitHeight: buttonNormal.height + opacity: enabled ? 1 : 0.3 + + Rectangle { + + id: buttonNormal + color: "#d4d4d4" + width: 100 //Bit of black magic to define the default size + height: 40 + + border.color: "gray" + border.width: 1 + radius: 2 + anchors.fill: parent //binding has to be preserved + + Text { + id: normalText + x: 26 + y: 14 //id only required to preserve binding + text: control.text //binding has to be preserved + //anchors.fill: parent + color: "gray" + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + } + + Rectangle { + id: buttonPressed + color: "#d4d4d4" + width: 100 //Bit of black magic to define the default size + height: 40 + + border.color: "gray" + border.width: 1 + radius: 2 + anchors.fill: parent //binding has to be preserved + + Text { + x: 26 + y: 14 + id: pressedText //id only required to preserve binding + text: control.text //binding has to be preserved + //anchors.fill: parent + color: "black" + + horizontalAlignment: Text.AlignHCenter // should not be preserved + verticalAlignment: Text.AlignVCenter // should not be preserved + elide: Text.ElideRight // should not be preserved + } + } + } + + contentItem: Item {} + + states: [ + State { + name: "normal" + when: !control.down + PropertyChanges { + target: buttonPressed + visible: false + } + PropertyChanges { + target: buttonNormal + visible: true + } + }, + State { + name: "down" + when: control.down + PropertyChanges { + target: buttonPressed + visible: true + } + PropertyChanges { + target: buttonNormal + visible: false + } + } + ] +} + |