~f-riccardo87/ubuntu-calculator-app/new-design

« back to all changes in this revision

Viewing changes to Screen.qml

  • Committer: Tarmac
  • Author(s): Dalius, Riccardo Ferrazzo
  • Date: 2013-02-24 14:32:52 UTC
  • mfrom: (7.1.21 ubuntu-calculator-app)
  • Revision ID: tarmac-20130224143252-lz4puf6xvq515jtt
Many UI improvements. More scientific buttons.

Approved by Riccardo Ferrazzo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import Ubuntu.Components 0.1
 
3
 
 
4
Rectangle{
 
5
    id: root
 
6
    height: columnA.height + units.gu(4)
 
7
    color: screenMA.pressed && !isLastItem ? "#FFDB88" : formulaView.color
 
8
 
 
9
    signal useAnswer(string answerToUse)
 
10
 
 
11
    Column {
 
12
        id: columnA
 
13
        spacing: units.gu(2)
 
14
        width: parent.width - units.gu(8)
 
15
        anchors.centerIn: parent
 
16
 
 
17
        Label {
 
18
            id: formulaLabel
 
19
            width: parent.width
 
20
            height: units.gu(13)
 
21
            font.pixelSize: units.gu(4)
 
22
            fontSizeMode: Text.Fit
 
23
            wrapMode: Text.WordWrap
 
24
            text: formula
 
25
        }
 
26
 
 
27
        Label {
 
28
            id: answerLabel
 
29
            width: parent.width
 
30
            height: units.gu(5)
 
31
            clip: true
 
32
            font.pixelSize: units.gu(4)
 
33
            color: "#dd4814"
 
34
            text: '= ' + answer
 
35
        }
 
36
    }
 
37
 
 
38
    Rectangle {
 
39
        visible: !isLastItem
 
40
        width: parent.width
 
41
        height: units.gu(1)/2
 
42
        anchors {
 
43
            left: parent.left
 
44
            right: parent.right
 
45
            bottom: parent.bottom
 
46
            bottomMargin: units.gu(1)
 
47
            leftMargin: units.gu(4)
 
48
            rightMargin: units.gu(4)
 
49
        }
 
50
        color: "#c0c0c0"
 
51
    }
 
52
 
 
53
    MouseArea {
 
54
        id: screenMA
 
55
        anchors.fill: parent
 
56
        onClicked: {
 
57
            if (answer.indexOf('error') == -1)
 
58
                root.useAnswer(answer)
 
59
        }
 
60
    }
 
61
}