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

« back to all changes in this revision

Viewing changes to CalcLabel.qml

  • Committer: Riccardo Ferrazzo
  • Date: 2013-03-08 09:35:39 UTC
  • Revision ID: f.riccardo87@gmail.com-20130308093539-4x88cnd6qswxwobe
scientificĀ calculatorĀ merged

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
 
    width: parent.width
7
 
    height: row.height
8
 
    color: "white"
9
 
 
10
 
    signal labelTxtChanged(string newText)
11
 
 
12
 
    property int operationsWidth: operatorLabel.width+formulaLabel.width
13
 
    property string operation: ""
14
 
    property string numbers: ""
15
 
    property bool labelReadOnly: false
16
 
    property string labelText: ""
17
 
    property int numbersHeight: units.gu(4)
18
 
    property string numbersColor: '#757373'
19
 
 
20
 
    Row{
21
 
        id: row
22
 
        height: numbersHeight
23
 
        width: parent.width
24
 
        TextField{
25
 
            id: numberName
26
 
            width: row.width-operatorLabel.width-formulaLabel.width
27
 
            anchors.bottom: parent.bottom
28
 
            ItemStyle.delegate: Item{} // removes ubuntu shape
29
 
            readOnly: labelReadOnly
30
 
            text: labelText
31
 
            onTextChanged: { labelText = numberName.text }
32
 
            hasClearButton: false
33
 
        }
34
 
        Label {
35
 
            id: operatorLabel
36
 
            width: units.gu(4)
37
 
            font.pixelSize: units.gu(4)
38
 
            text: root.operation
39
 
            font.family: "Ubuntu"
40
 
        }
41
 
        Label {
42
 
            id: formulaLabel
43
 
            width: units.gu(25)
44
 
            color: numbersColor
45
 
            anchors.bottom: parent.bottom
46
 
            font.pixelSize: numbersHeight
47
 
            fontSizeMode: Text.Fit
48
 
            horizontalAlignment: Text.AlignRight
49
 
            text: root.numbers
50
 
            font.family: "Ubuntu"
51
 
        }
52
 
    }
53
 
}