Upon changes in the table data (only possible by checking or unchecking a checkbox right now), update the corresponding PeptideIdentification / PeptideHits by adding a metavalue: 'selected'
| 992 | // Upon changes in the table data (only possible by checking or unchecking a checkbox right now), |
| 993 | // update the corresponding PeptideIdentification / PeptideHits by adding a metavalue: 'selected' |
| 994 | void SpectraIDViewTab::updatedSingleCell_(QTableWidgetItem* item) |
| 995 | { |
| 996 | // extract position of the correct Spectrum, PeptideIdentification and PeptideHit from the table |
| 997 | int row = item->row(); |
| 998 | String selected = item->checkState() == Qt::Checked ? "true" : "false"; |
| 999 | int spectrum_index = table_widget_->item(row, Clmn::SPEC_INDEX)->data(Qt::DisplayRole).toInt(); |
| 1000 | int num_id = table_widget_->item(row, Clmn::ID_NR)->data(Qt::DisplayRole).toInt(); |
| 1001 | int num_ph = table_widget_->item(row, Clmn::PEPHIT_NR)->data(Qt::DisplayRole).toInt(); |
| 1002 | |
| 1003 | // maintain sortability of our checkbox column |
| 1004 | TableView::updateCheckBoxItem(item); |
| 1005 | |
| 1006 | vector<PeptideIdentification>& pep_id = (*layer_->getPeakDataMuteable())[spectrum_index].getPeptideIdentifications(); |
| 1007 | |
| 1008 | // update "selected" value in the correct PeptideHits |
| 1009 | vector<PeptideHit>& hits = pep_id[num_id].getHits(); |
| 1010 | // XL-MS specific case, both PeptideHits belong to the same cross-link |
| 1011 | if (hits[0].metaValueExists("xl_chain")) |
| 1012 | { |
| 1013 | hits[0].setMetaValue("selected", selected); |
| 1014 | if (hits.size() >= 2) |
| 1015 | { |
| 1016 | hits[1].setMetaValue("selected", selected); |
| 1017 | } |
| 1018 | } |
| 1019 | else // general case, update only the selected PeptideHit |
| 1020 | { |
| 1021 | hits[num_ph].setMetaValue("selected", selected); |
| 1022 | } |
| 1023 | } |
| 1024 | |
| 1025 | void SpectraIDViewTab::fillRow_(const MSSpectrum& spectrum, const int spec_index, const QColor& background_color) |
| 1026 | { |
nothing calls this directly
no test coverage detected