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

Method updateEntries

src/openms_gui/source/VISUAL/DIATreeTab.cpp:259–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257 }
258
259 void DIATreeTab::updateEntries(LayerDataBase* layer)
260 {
261 if (layer == nullptr)
262 {
263 clear();
264 return;
265 }
266
267 if (!dia_treewidget_->isVisible() || dia_treewidget_->signalsBlocked())
268 {
269 return;
270 }
271 auto* lp = dynamic_cast<const LayerDataChrom*>(layer);
272 if (!lp) return;
273
274 OSWData* data = lp->getChromatogramAnnotation().get();
275
276 if (current_data_ == data)
277 {
278 // layer data is still the same as last time ..
279 // do not repopulate the table for now, since the data should not have changed
280 // Note: If we ever need to redraw, the tree's state (which subtress are expanded, which items are selected) will need to be remembered and restored
281 return;
282 }
283
284 // update last data pointer
285 current_data_ = data;
286
287 dia_treewidget_->blockSignals(true);
288 RAIICleanup clean([&]() { dia_treewidget_->blockSignals(false); });
289
290 dia_treewidget_->clear();
291
292 dia_treewidget_->setHeaders(Clmn::HEADER_NAMES);
293
294
295 if (data == nullptr // DIA tab is active, but the layer has no data to show...
296 || data->getProteins().empty())
297 {
298 dia_treewidget_->setHeaders(QStringList() << "No data");
299 }
300 else
301 {
302 for (size_t prot_index = 0; prot_index < data->getProteins().size(); ++prot_index)
303 {
304 const auto& prot = data->getProteins()[prot_index];
305 auto item_prot = createProt(prot, (int)prot_index);
306 dia_treewidget_->addTopLevelItem(item_prot);
307 }
308 }
309
310 populateSearchBox_();
311
312 // automatically set column width, depending on data
313 dia_treewidget_->header()->setStretchLastSection(false);
314 dia_treewidget_->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
315 }
316

Callers 1

callUpdateEntriesMethod · 0.45

Calls 8

createProtFunction · 0.85
clearFunction · 0.50
QStringListClass · 0.50
getMethod · 0.45
clearMethod · 0.45
setHeadersMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected