我有一個QTableView
實例限於單行選擇。我不想關心用戶按下的單元格,但它應該始終提取(selectedRow,0)中的數據。從QTableView提取數據
到目前爲止,我做了以下內容:
QModelIndexList indices = _ui->_tbl->selectionModel()->selection().indexes();
QModelIndex id = indices.at(0).sibling(indices.at(0).row(),0);
有沒有更好的辦法?
我找不到它在[DOC](http://doc.qt.nokia.com/latest/qabstractitemview.html#currentIndex)。是否有另一個我不知道的文檔? =) –
@Royi我發現這句話的Qt 4.7.3 DOC'QAbstractItemView中:: setCurrentIndex()' – azf