Qt World Summit: Submit your Presentation

Qtablewidget set Focus to a row and select the value?

  • Hello,

    i wanna change the value in a QtTableWidget and press enter. After i changed the value and pressed Enter, i wanna select(mark blue) the changed row. The Problem is i have an example code that makes what i want, but after view clicks they select all the rows from last row to the clicked row. I must click Escape Key to get out from this proble.

    Where ist the Problem? I think that the Problem is the Method.. Here ist the Code:

    void parameterChangedDelegate(QTableWidgetItem *item)

        int row = item->row();
        QModelIndex ninx = model()->index(row,1);
        selectionModel()->select(ninx, QItemSelectionModel::Select);


  • Moderators

    @Adrianos How about using setSelected ? Since you already have the QTableWidgetItem .