~zsombi/ubuntu-ui-toolkit/03-styleditem-styleset

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.header.qml

  • Committer: Zsombor Egri
  • Date: 2015-03-11 15:10:17 UTC
  • mfrom: (1434.1.15 02-styleset)
  • Revision ID: zsombor.egri@canonical.com-20150311151017-55iekp5lvd9a7mcj
prereq sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
import QtQuick 2.0
18
 
import Ubuntu.Components 1.1
 
18
import Ubuntu.Components 1.2
19
19
 
20
20
MainView {
 
21
    id: root
21
22
    width: units.gu(48)
22
23
    height: units.gu(60)
23
 
    useDeprecatedToolbar: false
24
24
    objectName: "mainView"
25
25
 
26
26
    Page {
27
27
        title: "Header"
 
28
        head.backAction: Action {
 
29
            iconName: "back"
 
30
            text: i18n.tr("Back")
 
31
            onTriggered: visible = false
 
32
        }
28
33
        head.contents: TextField {
 
34
            id: searchTextField
29
35
            objectName: "textfield"
30
36
            placeholderText: "Header"
31
 
            width: parent ? parent.width : 0
 
37
            inputMethodHints: Qt.ImhNoPredictiveText
 
38
            hasClearButton: false
 
39
 
 
40
            text: "Then two bears came out of the woods and mauled forty-two of the youths."
 
41
 
 
42
            anchors {
 
43
                fill: parent
 
44
                leftMargin: units.gu(1)
 
45
                topMargin: units.gu(0.5)
 
46
                bottomMargin: units.gu(0.5)
 
47
                rightMargin: units.gu(1)
 
48
            }
 
49
 
 
50
            secondaryItem: AbstractButton {
 
51
                height: searchTextField.height
 
52
                width: height
 
53
                enabled: searchTextField.text.length > 0
 
54
                Image {
 
55
                    objectName: "clearIcon"
 
56
                    anchors.fill: parent
 
57
                    anchors.margins: units.gu(.75)
 
58
                    source: "image://theme/clear"
 
59
                    opacity: searchTextField.text.length > 0
 
60
                    visible: opacity > 0
 
61
                    Behavior on opacity {
 
62
                        UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
 
63
                    }
 
64
                }
 
65
            }
 
66
        }
 
67
 
 
68
        Column {
 
69
            Label {
 
70
                text: "Above is a text field in the header"
 
71
            }
32
72
        }
33
73
    }
34
74
}