Files
qt-creator/doc/qtdesignstudio/examples/loginui2/PushButton.ui.qml

73 lines
1.7 KiB
QML
Raw Normal View History

import QtQuick 2.10
import QtQuick.Templates 2.1 as T
import loginui2 1.0
T.Button {
id: control
font: Constants.font
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: buttonBackground
Rectangle {
id: buttonBackground
color: "#41cd52"
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
border.color: "gray"
border.width: 1
radius: 2
}
contentItem: textItem
Text {
id: textItem
text: control.text
opacity: enabled ? 1.0 : 0.3
color: "#fdfdfd"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
states: [
State {
name: "normal"
when: !control.down
PropertyChanges {
target: buttonBackground
}
},
State {
name: "down"
when: control.down
PropertyChanges {
target: textItem
color: "#fdfdfd"
}
PropertyChanges {
target: buttonBackground
color: "#21be2b"
border.color: "black"
}
}
]
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/