|
1 import Qt 4.6 |
|
2 |
|
3 //Layout of the DialScreen control |
|
4 //------------------------------------ |
|
5 //|DialScreen | |
|
6 //| --------------------- ____ numberPad |
|
7 //| |dialNumber | / | |
|
8 //| ---------------------/ _|__ hangUpButton |
|
9 //| --------------------/- ------- / | |
|
10 //| | | | | | |/ | |
|
11 //| | 1 | 2 | 3 | | | | |
|
12 //| | | | | | | | |
|
13 //| ---------------------- | | | |
|
14 //| | | | | | | | |
|
15 //| | 4 | 5 | 6 | | | | |
|
16 //| | | | | ------- | |
|
17 //| ---------------------- _|__ callButton |
|
18 //| | | | | ------- / | |
|
19 //| | 7 | 8 | 9 | | |/ | |
|
20 //| | | | | | | | |
|
21 //| ---------------------- | | | |
|
22 //| | | | | | | | |
|
23 //| | * | 0 | # | | | | |
|
24 //| | | | | | | | |
|
25 //| ---------------------- ------- | |
|
26 //| | |
|
27 //------------------------------------ |
|
28 |
|
29 //! [0] |
|
30 Item { |
|
31 width: childrenRect.width |
|
32 height: childrenRect.height |
|
33 property string dialString |
|
34 signal dial(string numberToDial) |
|
35 signal hangup |
|
36 //! [0] |
|
37 |
|
38 Rectangle { |
|
39 id: dialNumber |
|
40 height: 20 |
|
41 width: numberPad.width |
|
42 anchors.top: parent.top |
|
43 anchors.left: parent.left |
|
44 color: "white" |
|
45 radius: 5 |
|
46 border.width: 3 |
|
47 border.color: "black" |
|
48 |
|
49 Text { |
|
50 text: dialString |
|
51 anchors.centerIn: parent |
|
52 } |
|
53 } |
|
54 |
|
55 Grid { |
|
56 id: numberPad |
|
57 width: childrenRect.width |
|
58 height: childrenRect.height |
|
59 anchors.top: dialNumber.bottom |
|
60 anchors.left: parent.left |
|
61 anchors.topMargin: 5 |
|
62 columns: 3 |
|
63 spacing: 5 |
|
64 |
|
65 DialButton { buttonText: "1"; onClicked: { dialString += "1";} } |
|
66 DialButton { buttonText: "2"; onClicked: { dialString += "2";} } |
|
67 DialButton { buttonText: "3"; onClicked: { dialString += "3";} } |
|
68 DialButton { buttonText: "4"; onClicked: { dialString += "4";} } |
|
69 DialButton { buttonText: "5"; onClicked: { dialString += "5";} } |
|
70 DialButton { buttonText: "6"; onClicked: { dialString += "6";} } |
|
71 DialButton { buttonText: "7"; onClicked: { dialString += "7";} } |
|
72 DialButton { buttonText: "8"; onClicked: { dialString += "8";} } |
|
73 DialButton { buttonText: "9"; onClicked: { dialString += "9";} } |
|
74 DialButton { buttonText: "*"; onClicked: { dialString += "*";} } |
|
75 DialButton { buttonText: "0"; onClicked: { dialString += "0";} } |
|
76 DialButton { buttonText: "#"; onClicked: { dialString += "#";} } |
|
77 } |
|
78 |
|
79 //! [1] |
|
80 DialButton { |
|
81 id: hangUpButton |
|
82 height: { (numberPad.height / 2) - 2 } |
|
83 width: 50 |
|
84 anchors.top: numberPad.top |
|
85 anchors.left: numberPad.right |
|
86 anchors.leftMargin: 5 |
|
87 hoverColor: "red" |
|
88 color: "crimson" |
|
89 onClicked: { |
|
90 dialString = "" |
|
91 hangup() |
|
92 } |
|
93 //! [1] |
|
94 Image { |
|
95 anchors.centerIn: parent |
|
96 source: "hangup.png" |
|
97 transformOrigin: "Center" |
|
98 } |
|
99 } |
|
100 |
|
101 //! [2] |
|
102 DialButton { |
|
103 id: callButton |
|
104 width: 50 |
|
105 height: {(numberPad.height/2) -2} |
|
106 anchors.top: hangUpButton.bottom |
|
107 anchors.left: numberPad.right |
|
108 anchors.leftMargin: 5 |
|
109 anchors.topMargin: 4 |
|
110 color: "mediumseagreen" |
|
111 hoverColor: "lightgreen" |
|
112 onClicked: { |
|
113 if (dialString != "") { |
|
114 dial(dialString) |
|
115 dialString = "" |
|
116 } |
|
117 } |
|
118 //! [2] |
|
119 |
|
120 Image { |
|
121 anchors.centerIn: parent |
|
122 source: "call.png" |
|
123 transformOrigin: "Center" |
|
124 } |
|
125 } |
|
126 } |