diff --git a/components/TableView.qml b/components/TableView.qml index f3f7510a123a24961fdf924ac70fc182d7967a8e..acdaeaa303316565e0bafaeff99c96de92f6ed1d 100644 --- a/components/TableView.qml +++ b/components/TableView.qml @@ -199,12 +199,11 @@ FocusScope{ autodecrement = false } - var x = Math.min(contentX + tree.width - 5, Math.max(mouseX + contentX, contentX)) var y = Math.min(contentY + tree.height - 5, Math.max(mouseY + contentY, contentY)) - var newIndex =tree.indexAt(x, y) + var newIndex = tree.indexAt(0, y) if (newIndex > 0) - tree.currentIndex = tree.indexAt(x, y) + tree.currentIndex = tree.indexAt(0, y) } onPressed: { tree.forceActiveFocus() diff --git a/examples/ItemViewGallery.qml b/examples/ItemViewGallery.qml index 7a2913f47a57393428310d96a72d443e6115b703..13ed6230e6f0ddbaa77dead3bbb83c3fd95a9d4b 100644 --- a/examples/ItemViewGallery.qml +++ b/examples/ItemViewGallery.qml @@ -236,7 +236,7 @@ Rectangle { } Component { - id: delegate3 + id: editableDelegate Item { Text { width: parent.width @@ -248,13 +248,14 @@ Rectangle { color: itemForeground visible: !itemSelected } - TextInput{ - color: itemForeground + Loader { // Initialize text editor lazily to improve performance anchors.fill: parent anchors.margins: 4 - visible: itemSelected - text: itemValue ? itemValue : "" - onTextChanged: model.setProperty(rowIndex, itemProperty, text) + property string modelText: itemValue + property string editorText: item ? item.text : itemValue + onEditorTextChanged: model.setProperty(rowIndex, itemProperty, editorText) + sourceComponent: itemSelected ? editor : null + Component {id: editor ; TextInput{ color: itemForeground ; text: modelText} } } } } @@ -321,7 +322,7 @@ Rectangle { case 1: return delegate2 case 2: - return delegate3 + return editableDelegate } } }