diff options
Diffstat (limited to 'demos/declarative/snake/content/Button.qml')
-rw-r--r-- | demos/declarative/snake/content/Button.qml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/demos/declarative/snake/content/Button.qml b/demos/declarative/snake/content/Button.qml new file mode 100644 index 0000000..63cd555 --- /dev/null +++ b/demos/declarative/snake/content/Button.qml @@ -0,0 +1,25 @@ +import Qt 4.6 + +Rectangle { + id: container + + signal clicked + property string text: "Button" + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } + + Text { + id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText + } +} |