forked from qt-creator/qt-creator
QmlDesigner: Add default Connections to wizard template
Task-number: QDS-5963 Change-Id: I894ce59adfaafa6ff71d6fa958b8aa836564a20a Reviewed-by: Brook Cronin <brook.cronin@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -10,14 +10,62 @@ import QtQuick.Controls %{QtQuickVersion}
|
|||||||
import %{ImportModuleName} %{ImportModuleVersion}
|
import %{ImportModuleName} %{ImportModuleVersion}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: rectangle
|
||||||
width: Constants.width
|
width: Constants.width
|
||||||
height: Constants.height
|
height: Constants.height
|
||||||
|
|
||||||
color: Constants.backgroundColor
|
color: Constants.backgroundColor
|
||||||
|
|
||||||
Text {
|
Button {
|
||||||
text: qsTr("Hello %{ProjectName}")
|
id: button
|
||||||
anchors.centerIn: parent
|
text: qsTr("Press me")
|
||||||
font.family: Constants.font.family
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
checkable: true
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: button
|
||||||
|
onClicked: animation.start()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: label
|
||||||
|
text: qsTr("Hello %{ProjectName}")
|
||||||
|
anchors.top: button.bottom
|
||||||
|
font.family: Constants.font.family
|
||||||
|
anchors.topMargin: 45
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: animation
|
||||||
|
|
||||||
|
ColorAnimation {
|
||||||
|
id: colorAnimation1
|
||||||
|
target: rectangle
|
||||||
|
property: "color"
|
||||||
|
to: "#2294c6"
|
||||||
|
from: Constants.backgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorAnimation {
|
||||||
|
id: colorAnimation2
|
||||||
|
target: rectangle
|
||||||
|
property: "color"
|
||||||
|
to: Constants.backgroundColor
|
||||||
|
from: "#2294c6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "clicked"
|
||||||
|
when: button.checked
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
target: label
|
||||||
|
text: qsTr("Button Checked")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user