summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/focusscopes.qml
blob: 686de29c068799ad3cc3f4ae0a02427d0ac2de82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import Qt 4.7

//![0]
Rectangle {
     color: "lightsteelblue"; width: 240; height: 320

     ListView {
         anchors.fill: parent
         focus: true

         model: ListModel {
             ListElement { name: "Bob" }
             ListElement { name: "John" }
             ListElement { name: "Michael" }
         }

         delegate: FocusScope {
             width: childrenRect.width; height: childrenRect.height
             TextInput {
                 focus: true
                 text: name
                 Keys.onReturnPressed: console.log(name)
             }
         }
     }
 }
//![0]