Files
qt-creator/share/qtcreator/qmldesigner/Button.qml
Kai Koehne 818a7b226b New QmlDesigner plugin & Design mode
This adds a new "Design" mode that can be used to manipulate qml files
in a visual way. It will only get build if you have the declarativeui
module in Qt.

This is a squashed import from the Bauhaus project. Share & enjoy :)
2010-01-07 12:14:35 +01:00

87 lines
1.9 KiB
QML

import Qt 4.6
Rectangle {
property var label: "Button"
signal clicked
width: 75
height: 20
radius: 10
color: "grey"
Rectangle {
anchors.fill: parent;
anchors.leftMargin: 1;
anchors.rightMargin: 1;
anchors.topMargin: 1;
anchors.bottomMargin: 1;
color: "#2c2c2c";
radius: 9
Rectangle {
id: buttonGradientRectangle
anchors.fill: parent;
anchors.leftMargin: 1;
anchors.rightMargin: 1;
anchors.topMargin: 1;
anchors.bottomMargin: 1;
color: "black";
gradient: normalGradient
radius: 8;
Gradient {
id: pressedGradient
GradientStop { position: 0.0; color: "#686868" }
GradientStop { position: 1.0; color: "#8a8a8a" }
}
Gradient {
id: normalGradient
GradientStop { position: 0.0; color: "#8a8a8a" }
GradientStop { position: 1.0; color: "#686868" }
}
}
}
Text {
color: "white"
text: parent.label
style: "Raised";
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
horizontalAlignment: "AlignHCenter";
verticalAlignment: "AlignVCenter";
}
MouseRegion {
id: mouseRegion
anchors.fill: parent
onReleased: { parent.clicked.emit(); }
}
states: [
State {
name: "released"
when: !mouseRegion.pressed
PropertyChanges {
target: buttonGradientRectangle
gradient: normalGradient
}
},
State {
name: "pressed"
when: mouseRegion.pressed
PropertyChanges {
target: buttonGradientRectangle
gradient: pressedGradient
}
}
]
}