But if you have the index of the currently selected cell, you can get it's row, so it looks like "target = model->data(model->index(editIndex.first().row(), 0));" would then work.
Edit: Glad you got it working.
But if you have the index of the currently selected cell, you can get it's row, so it looks like "target = model->data(model->index(editIndex.first().row(), 0));" would then work.
Edit: Glad you got it working.
Last edited by norobro; 26th February 2010 at 04:07.
The problem was, selectedRows() or selectedIndexes() only returned the value of the selected cell(s); it does not return the indexes of all values in the row. So the QModelIndexList editIndex would only recieve the data from "NOTES" if it was the only cell selected. It would only work properly if the entire row was selected, thus returning the correct index and it's data. Otherwise, it only returned the data of the first index in editIndex, which may or may not of been what I wanted, and the rest of the code would then look for a value that never existed.
With what I did, I simply got the index of the the cell, then from that index, get the row value of the index (passed in the "row" parameter of model-index(row, column), and then specificied the column I wanted.
But once again, thanks for getting me on the right track. Your usage of of the index() function of model and .row(), got the juices flowin'.
Bookmarks