Enter manually in TableView
Unsolved
QML and Qt Quick
-
Hi, I would to enter and edit the first cell of the tableview pressing the buttonEdit and then edit the next cell pressing buttonEditNext.
I don't want to use mouse click.
How can I do?
import QtQuick 2.6 import QtQuick.Controls 1.5 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Test TableView") toolBar: ToolBar { height: 50 Rectangle { id: rectangle anchors.fill: parent Button { id: buttonEdit x: 18 y: 8 width: 100 height: 27 text: qsTr("Edit") onClicked: { //TODO Go to edit first cell } } Button { id: buttonEditNext x: 118 y: 8 width: 100 height: 27 text: qsTr("Edit next") onClicked: { //TODO Go to edit next cell } } } } TableView { id: tableView anchors.fill: parent focus: true TableViewColumn { id: titleColumn title: "Title" role: "title" movable: false resizable: false width: tableView.viewport.width - authorColumn.width delegate: TextInput { anchors.fill: parent id: textInputTitle text: sourceModel.get(styleData.row).title } } TableViewColumn { id: authorColumn title: "Author" role: "author" movable: false resizable: false width: tableView.viewport.width / 3 delegate: TextInput { anchors.fill: parent id: textInputAuthor text: sourceModel.get(styleData.row).author } } model: sourceModel ListModel { id: sourceModel ListElement { title: "Moby-Dick" author: "Herman Melville" } ListElement { title: "The Adventures of Tom Sawyer" author: "Mark Twain" } } } }