MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / getSelectedScan

Method getSelectedScan

src/openms_gui/source/VISUAL/SpectraTreeTab.cpp:161–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

copyLayerMethod · 0.80

Calls 5

toIntMethod · 0.80
getChromatogramsMethod · 0.80
addSpectrumMethod · 0.80
clearMethod · 0.45
addChromatogramMethod · 0.45

Tested by

no test coverage detected