| 159 | } |
| 160 | |
| 161 | bool SpectraTreeTab::getSelectedScan(MSExperiment& exp, LayerDataBase::DataType& current_type) const |
| 162 | { |
| 163 | exp.clear(true); |
| 164 | QTreeWidgetItem* item = spectra_treewidget_->currentItem(); |
| 165 | if (item == nullptr) |
| 166 | { |
| 167 | return false; |
| 168 | } |
| 169 | // getting the index works for PEAK and CHROM data |
| 170 | int index = item->data(ClmnPeak::SPEC_INDEX, Qt::DisplayRole).toInt(); |
| 171 | if (spectra_treewidget_->headerItem()->text(ClmnChrom::MZ) == ClmnChrom::HEADER_NAMES[ClmnChrom::MZ]) |
| 172 | { // we currently show chromatogram data |
| 173 | current_type = LayerDataBase::DT_CHROMATOGRAM; |
| 174 | exp.addChromatogram(last_peakmap_->getChromatograms()[index]); |
| 175 | } |
| 176 | else |
| 177 | { |
| 178 | current_type = LayerDataBase::DT_PEAK; |
| 179 | exp.addSpectrum(last_peakmap_->getSpectra()[index]); |
| 180 | } |
| 181 | return true; |
| 182 | } |
| 183 | |
| 184 | void SpectraTreeTab::itemSelectionChange_(QTreeWidgetItem* current, QTreeWidgetItem* /*previous*/) |
| 185 | { |
no test coverage detected