OpenMS
SpectraTreeTab.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Timo Sachsenberg $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <QtWidgets>
12 
13 
16 
17 class QLineEdit;
18 class QComboBox;
19 class QTreeWidget;
20 class QTreeWidgetItem;
21 
22 namespace OpenMS
23 {
24  class TreeView;
30  class OPENMS_GUI_DLLAPI SpectraTreeTab :
31  public QWidget,
32  public DataTabBase
33  {
34  Q_OBJECT
35 public:
37  SpectraTreeTab(QWidget * parent = nullptr);
38 
40  ~SpectraTreeTab() override = default;
41 
43  bool hasData(const LayerDataBase* layer) override;
44 
46  void updateEntries(LayerDataBase* cl) override;
47 
49  void clear() override;
50 
58  bool getSelectedScan(MSExperiment& exp, LayerDataBase::DataType& current_type) const;
59 
60 signals:
61  void spectrumSelected(int);
62  void chromsSelected(std::vector<int> indices);
64  void chromsDoubleClicked(std::vector<int> indices);
66  void showChromatogramsAsNew1D(std::vector<int> indices);
68 private:
69  QLineEdit* spectra_search_box_ = nullptr;
70  QComboBox* spectra_combo_box_ = nullptr;
71  TreeView* spectra_treewidget_ = nullptr;
72  LayerDataBase* layer_ = nullptr;
74  std::map<size_t, std::map<Precursor, std::vector<Size>, Precursor::MZLess> > map_precursor_to_chrom_idx_cache_;
76  const PeakMap* last_peakmap_ = nullptr;
77 
78 private slots:
79 
85  void itemSelectionChange_(QTreeWidgetItem *, QTreeWidgetItem *);
87  void searchAndShow_();
89  void itemDoubleClicked_(QTreeWidgetItem *);
91  void spectrumContextMenu_(const QPoint &);
92  };
93 }
94 
all tabs need to implement this interface
Definition: DataSelectionTabs.h:31
Class that stores the data for one layer.
Definition: LayerDataBase.h:169
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
Hierarchical visualization and selection of spectra.
Definition: SpectraTreeTab.h:33
void showChromatogramsAsNew1D(std::vector< int > indices)
void spectrumDoubleClicked(int)
void spectrumSearchText_()
searches for rows containing a search text (from spectra_search_box_); called when text search box is...
std::map< size_t, std::map< Precursor, std::vector< Size >, Precursor::MZLess > > map_precursor_to_chrom_idx_cache_
cache to store mapping of chromatogram precursors to chromatogram indices
Definition: SpectraTreeTab.h:74
void chromsDoubleClicked(std::vector< int > indices)
void showSpectrumAsNew1D(int)
void itemSelectionChange_(QTreeWidgetItem *, QTreeWidgetItem *)
emits spectrumSelected() for PEAK or chromsSelected() for CHROM data
void searchAndShow_()
searches using text box and plots the spectrum
bool hasData(const LayerDataBase *layer) override
docu in base class
~SpectraTreeTab() override=default
Destructor.
void populateSearchBox_()
fill the search-combo-box with current column header names
void spectrumContextMenu_(const QPoint &)
Display context menu; allows to open metadata window.
void showSpectrumMetaData(int)
void chromsSelected(std::vector< int > indices)
SpectraTreeTab(QWidget *parent=nullptr)
Constructor.
void updateEntries(LayerDataBase *cl) override
refresh the table using data from cl
bool getSelectedScan(MSExperiment &exp, LayerDataBase::DataType &current_type) const
void clear() override
remove all visible data
void itemDoubleClicked_(QTreeWidgetItem *)
called upon double click on an item; emits spectrumDoubleClicked() or chromsDoubleClicked() after som...
A better QTreeWidget for TOPPView, which supports header context menu and conveniently adding/getting...
Definition: TreeView.h:22
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
DataType
Definition: LayerDataBase.h:73
Comparator by m/z position.
Definition: Peak1D.h:177