Ok, i have QAbstractItemMode object with 4 columns and N rows.
i need get data from column ID and current double-clicked row
Ok, i have QAbstractItemMode object with 4 columns and N rows.
i need get data from column ID and current double-clicked row
You need to concentrate on the view, not the model. I assume it is a QTableView. The QAbstractItemView::doubleClicked() signal will give you the model index that was clicked on. You now have the QModelIndex::row() and can easily build another QModelIndex with the column set to 0 ( or whichever model column is the ID) using QModelIndex::sibling() or some other method.
Normally double-clicking would put the affected cells into edit mode. Is the model editable or not?
Last edited by ChrisW67; 27th January 2011 at 00:34.
I'm not sure if I understand your question but in case you are looking for a way to find the currently selected row(s), you'll need to look in the view object displaying the data rather than the model itself.
QAbstractItemView::selectedIndexes ()
QAbstractItemView::selectionModel ()
Editmode is off. One click whole row is selected.
no. i will use QAbstractItemModel because it's necessary for my project. Any ideas?You need to concentrate on the view, not the model. I assume it is a QTableView.
You must be using some sort of view, since QAbstractItemModel doesn't display anything itself. What ChrisW67 meant was that, to judge from your uploaded image, your code seems to use QTableView to present the data.
Can you post the part of your code where you instantiate your model subclass (possibly in MainWindow or something similar).
Bookmarks