diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/focus.qdoc | 23 | ||||
-rw-r--r-- | doc/src/snippets/declarative/focusscopes.qml | 27 |
2 files changed, 28 insertions, 22 deletions
diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index e5c1d32..e2b8bb6 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -291,28 +291,7 @@ print the name of the current list item. \table \row -\o \code -Rectangle { - color: "lightsteelblue"; width: 240; height: 320 - - ListView { - id: myView; anchors.fill: parent; focus: true - model: ListModel { - ListElement { name: "Bob" } - ListElement { name: "John" } - ListElement { name: "Michael" } - } - delegate: FocusScope { - width: contents.width; height: contents.height - Text { - focus: true - text: name - Keys.onReturnPressed: console.log(name) - } - } - } -} -\endcode +\o \snippet doc/src/snippets/declarative/focusscopes.qml 0 \o \image declarative-qmlfocus4.png \endtable diff --git a/doc/src/snippets/declarative/focusscopes.qml b/doc/src/snippets/declarative/focusscopes.qml new file mode 100644 index 0000000..686de29 --- /dev/null +++ b/doc/src/snippets/declarative/focusscopes.qml @@ -0,0 +1,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] |