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

Method spectrumSearchText_

src/openms_gui/source/VISUAL/SpectraTreeTab.cpp:135–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133 }
134
135 void SpectraTreeTab::spectrumSearchText_()
136 {
137 const QString& text = spectra_search_box_->text(); // get text from QLineEdit
138 if (!text.isEmpty())
139 {
140 Qt::MatchFlags matchflags = Qt::MatchFixedString;
141 matchflags |= Qt::MatchRecursive; // match subitems (below top-level)
142 // 'index' must be named identically for both data types
143 assert(ClmnPeak::HEADER_NAMES[ClmnPeak::SPEC_INDEX] == ClmnChrom::HEADER_NAMES[ClmnChrom::CHROM_INDEX]);
144 // ... for the following to work:
145 if (spectra_combo_box_->currentText() != ClmnPeak::HEADER_NAMES[ClmnPeak::SPEC_INDEX])
146 { // only the 'index' has to be matched exactly
147 matchflags |= Qt::MatchStartsWith;
148 }
149 QList<QTreeWidgetItem*> searched = spectra_treewidget_->findItems(text, matchflags, spectra_combo_box_->currentIndex());
150
151 if (!searched.isEmpty())
152 {
153 spectra_treewidget_->clearSelection();
154 searched.first()->setSelected(true);
155 spectra_treewidget_->update();
156 spectra_treewidget_->scrollToItem(searched.first());
157 }
158 }
159 }
160
161 bool SpectraTreeTab::getSelectedScan(MSExperiment& exp, LayerDataBase::DataType& current_type) const
162 {

Callers

nothing calls this directly

Calls 3

setSelectedMethod · 0.80
isEmptyMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected