OpenMS
TreeView.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <QTreeWidget>
12 
14 
15 namespace OpenMS
16 {
20  class TreeView :
21  public QTreeWidget
22  {
23  Q_OBJECT
24  public:
26  TreeView(QWidget* parent = nullptr);
28  ~TreeView() override = default;
29 
31  void setHeaders(const QStringList& headers);
32 
35  void hideColumns(const QStringList& header_names);
36 
43  QStringList getHeaderNames(const WidgetHeader which) const;
44 
47  QString getHeaderName(const int header_column) const;
48 
49  private slots:
51  void headerContextMenu_(const QPoint& pos);
52  };
53 }
A better QTreeWidget for TOPPView, which supports header context menu and conveniently adding/getting...
Definition: TreeView.h:22
void setHeaders(const QStringList &headers)
sets the visible headers (and the number of columns)
void headerContextMenu_(const QPoint &pos)
Display header context menu; allows to show/hide columns.
~TreeView() override=default
Destructor.
QStringList getHeaderNames(const WidgetHeader which) const
Obtain header names, either from all, or only the visible columns.
void hideColumns(const QStringList &header_names)
TreeView(QWidget *parent=nullptr)
Constructor.
QString getHeaderName(const int header_column) const
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
WidgetHeader
Enum to decide which headers(=column) names should be get/set in a table/tree widget.
Definition: CommonDefs.h:27