Hello,
Thank you so much for the response. I think I must be confusing something, this works for mouse clicking, it forces back to column 1. However, still on the arrow key behavior I get a dotted line surrounding the column 1 but the selection is still on column 0. Either way this gives me a lot of information to go on. Thank you for that, I missed that I had to implement the superclass to get the desired behavior.
Thank you so much!
AlphaWolfXV
Added after 11 minutes:
I made a qDebug to illustrate the behavior is working like it should, just the selection is not updating - I believe the index is correct, just the cell selected is not correct with the key events...
qDebug()<<"cR:"<<current.row()<<"cC:"<<current.column()<<"pR:"<<previous.row()<<"pC:"<<previous.column();
if (current.isValid() && current.column() == 0) {
qDebug()<<"wow, we need to change it..."<<current.row()<<current.column();
setCurrentIndex(index);
// Or, to move the current item without changing the selected items
//selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
}
}
};
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
qDebug()<<"cR:"<<current.row()<<"cC:"<<current.column()<<"pR:"<<previous.row()<<"pC:"<<previous.column();
QTableView::currentChanged(current, previous);
if (current.isValid() && current.column() == 0) {
qDebug()<<"wow, we need to change it..."<<current.row()<<current.column();
QModelIndex index = current.sibling(current.row(), 1);
setCurrentIndex(index);
// Or, to move the current item without changing the selected items
//selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
}
}
};
To copy to clipboard, switch view to plain text mode
Capture5.jpg
Bookmarks