Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

How to set the focus to a specific row/col in a TableView

$
0
0
Hello, I have a TableView like shown below. What I want to achieve is that if the user enters a number and presses the Enter key, the cursor is automatically placed in the next row, same column. I could catch the enter key like below, but I guess what I currently can’t figure out is how to then set the focus to specific row/col.     TableView {         id: tableView         anchors.fill: parent         model: temperatureModel         TableViewColumn{role: "tempAvrg"; title: "Average °C."; width: columnWidth}         TableViewColumn{role: "tempMin"; title: "Min. °C"; width: columnWidth}         TableViewColumn{role: "tempMax"; title: "Max. °C."; width: columnWidth}         itemDelegate:             TextInput {                 id: textInput                 text: styleData.value.toFixed(1)                 Keys.onReturnPressed: {                     //how can I move the focus to the next row, same column?                     console.log("Enter Pressed");                 }                 onEditingFinished: {                      temperatureModel.update(styleData.role, styleData.row, text);                 }               }          }     }

Viewing all articles
Browse latest Browse all 4972

Trending Articles