~ubuntu-branches/debian/jessie/qtdeclarative-opensource-src/jessie

« back to all changes in this revision

Viewing changes to examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml

  • Committer: Package Import Robot
  • Author(s): Lisandro Damián Nicanor Pérez Meyer, Lisandro Damián Nicanor Pérez Meyer
  • Date: 2013-08-30 22:09:43 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130830220943-en0u2dm8cfxpi53o
Tags: 5.1.1-1
[ Lisandro Damián Nicanor Pérez Meyer ]
* New upstream release.
* Update symbols file with buildds' logs.
* Remove fix_systemdialogs_path, applied upstream.
* Adjust examples install file.
* Update symbols files with current build.
* Tighten Qt 5 build dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
Rectangle {
45
45
    id: menuBar
46
 
    width: 1000; height:300
47
 
    color:"transparent"
 
46
    width: 1000; height: 300
 
47
    color: "transparent"
48
48
    property color fileColor: "plum"
49
49
    property color editColor: "powderblue"
50
50
 
51
 
    property real partition: 1/10
 
51
    property real partition: 1 / 10
52
52
 
53
53
    Column {
54
54
        anchors.fill: parent
55
 
        //container for the header and the buttons
56
55
        z: 1
 
56
 
 
57
        // Container for the header and the buttons
57
58
        Rectangle {
58
59
            id: labelList
59
 
            height:menuBar.height*partition
 
60
            height: menuBar.height * partition
60
61
            width: menuBar.width
61
62
            color: "beige"
62
63
            gradient: Gradient {
65
66
                GradientStop { position: 0.98;color: "#3F3F3F" }
66
67
                GradientStop { position: 1.0; color: "#0e1B20" }
67
68
            }
 
69
 
68
70
            Text {
69
71
                height: parent.height
70
 
                anchors { right: labelRow.left ; verticalCenter: parent.bottom }
71
 
                text: "menu:    " 
 
72
                anchors { right: labelRow.left; verticalCenter: parent.bottom }
 
73
                text: "menu:    "
72
74
                color: "lightblue"
73
75
                font { weight: Font.Light; italic: true }
74
76
            }
75
 
            //row displays its children in a vertical row
 
77
 
 
78
            // Row displays its children in a vertical row
76
79
            Row {
77
80
                id: labelRow
78
81
                anchors.centerIn: parent
79
 
                spacing:40
 
82
                spacing: 40
 
83
 
80
84
                Button {
81
85
                    id: fileButton
82
 
                    height: 20; width: 50
 
86
                    width: 50; height: 20
83
87
                    label: "File"
84
 
                    buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5)
85
 
                    scale: menuListView.currentIndex == 0? 1.25: 1
86
 
                    labelSize: menuListView.currentIndex == 0? 16:12
 
88
                    buttonColor: menuListView.currentIndex == 0 ? fileColor : Qt.darker(fileColor, 1.5)
 
89
                    scale: menuListView.currentIndex == 0 ? 1.25 : 1
 
90
                    labelSize: menuListView.currentIndex == 0 ? 16 : 12
87
91
                    radius: 1
88
 
                    //on a button click, change the list's currently selected item to FileMenu
 
92
 
 
93
                    // On a button click, change the list's currently selected item to FileMenu
89
94
                    onButtonClick: menuListView.currentIndex = 0
 
95
 
90
96
                    gradient: Gradient {
91
97
                        GradientStop { position: 0.0; color: fileColor }
92
98
                        GradientStop { position: 1.0; color: "#136F6F6F" }
93
99
                    }
94
100
                }
 
101
 
95
102
                Button {
96
103
                    id: editButton
97
 
                    height: 20; width: 50
98
 
                    buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9)
99
 
                    scale: menuListView.currentIndex == 1? 1.25: 1    
 
104
                    width: 50; height: 20
 
105
                    buttonColor : menuListView.currentIndex == 1 ? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9)
 
106
                    scale: menuListView.currentIndex == 1 ? 1.25 : 1
100
107
                    label: "Edit"
101
108
                    radius: 1
102
 
                    labelSize: menuListView.currentIndex == 1? 16:12
 
109
                    labelSize: menuListView.currentIndex == 1 ? 16 : 12
 
110
 
103
111
                    //on a button click, change the list's currently selected item to EditMenu
104
 
                    onButtonClick: menuListView.currentIndex = 1    
 
112
                    onButtonClick: menuListView.currentIndex = 1
105
113
                    gradient: Gradient {
106
114
                        GradientStop { position: 0.0; color: editColor }
107
115
                        GradientStop { position: 1.0; color: "#136F6F6F" }
110
118
            }
111
119
        }
112
120
 
113
 
        //list view will display a model according to a delegate
 
121
        // A ListView will display a model according to a delegate
114
122
        ListView {
115
123
            id: menuListView
116
 
            width:menuBar.width; height: 9*menuBar.height*partition
 
124
            width: menuBar.width
 
125
            height: 9 * menuBar.height * partition
117
126
 
118
 
            //the model contains the data
 
127
            // The model contains the data
119
128
            model: menuListModel
120
129
 
121
130
            //control the movement of the menu switching
122
131
            snapMode: ListView.SnapOneItem
123
132
            orientation: ListView.Horizontal
124
 
            boundsBehavior: Flickable.StopAtBounds 
 
133
            boundsBehavior: Flickable.StopAtBounds
125
134
            flickDeceleration: 5000
126
135
            highlightFollowsCurrentItem: true
127
 
            highlightMoveDuration:240
 
136
            highlightMoveDuration: 240
128
137
            highlightRangeMode: ListView.StrictlyEnforceRange
129
138
        }
130
139
    }
131
 
    //a list of visual items already have delegates handling their display
 
140
 
 
141
    // A list of visual items that already have delegates handling their display
132
142
    ObjectModel {
133
143
        id: menuListModel
134
144
 
135
145
        FileMenu {
136
 
            id:fileMenu
137
 
            width: menuListView.width; height: menuListView.height
 
146
            id: fileMenu
 
147
            width: menuListView.width
 
148
            height: menuListView.height
138
149
            color: fileColor
139
150
        }
140
151
        EditMenu {
141
152
            color: editColor
142
 
            width:  menuListView.width; height: menuListView.height
 
153
            width: menuListView.width
 
154
            height: menuListView.height
143
155
        }
144
156
    }
145
157
}