--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtmobility/examples/declarative-sfw-dialer/sfwexample/DialButton.qml Mon May 03 13:18:40 2010 +0300
@@ -0,0 +1,72 @@
+import Qt 4.6
+
+//Implementation of the dialButton control.
+Item {
+ id: dialButton
+ width: 50
+ height: 50
+ property alias buttonText: innerText.text;
+ property alias color: rectangleButton.color
+ property color hoverColor: "lightsteelblue"
+ property color pressColor: "slategray"
+ signal clicked
+
+ Rectangle {
+ id: rectangleButton
+ anchors.fill: parent
+ radius: 5
+ color: "steelblue"
+ border.width: 3
+ border.color: "black"
+
+ Text {
+ id: innerText
+ font.pointSize: 20
+ anchors.centerIn: parent
+ }
+ }
+
+ states: [
+ State {
+ name: "Hovering"
+ PropertyChanges {
+ target: rectangleButton
+ color: hoverColor
+ }
+ },
+ State {
+ name: "Pressed"
+ PropertyChanges {
+ target: rectangleButton
+ color: pressColor
+ }
+ }
+ ]
+
+
+ transitions: [
+ Transition {
+ from: ""; to: "Hovering"
+ ColorAnimation { duration: 100 }
+ },
+ Transition {
+ from: "*"; to: "Pressed"
+ ColorAnimation { duration: 10 }
+ }
+ ]
+
+ MouseArea {
+ hoverEnabled: true
+ anchors.fill: dialButton
+ onEntered: { dialButton.state='Hovering'}
+ onExited: { dialButton.state=''}
+ onClicked: { dialButton.clicked();}
+ onPressed: { dialButton.state="Pressed" }
+ onReleased: {
+ if (containsMouse)
+ dialButton.state="Hovering";
+ else
+ dialButton.state="";
+ }
+ }
+}